matrix_sdk 2.1.3 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -47,7 +47,7 @@ module MatrixSdk::Protocols::MSC
47
47
  query[:user_id] = params.delete(:user_id) if protocol?(:AS) && params.key?(:user_id)
48
48
 
49
49
  req = Net::HTTP::Get.new(homeserver.dup.tap do |u|
50
- u.path = api_to_path(:client_r0) + '/sync/sse'
50
+ u.path = "#{api_to_path :client_r0}/sync/sse"
51
51
  u.query = URI.encode_www_form(query)
52
52
  end)
53
53
  req['accept'] = 'text/event-stream'
@@ -60,7 +60,9 @@ module MatrixSdk::Protocols::MSC
60
60
  # rubocop:disable Metrics/BlockLength
61
61
  thread = Thread.new(cancellation_token) do |ctx|
62
62
  print_http(req)
63
+ @http_lock.lock
63
64
  http.request req do |response|
65
+ @http_lock.unlock
64
66
  break unless ctx[:run]
65
67
 
66
68
  print_http(response, body: false)
@@ -136,6 +138,8 @@ module MatrixSdk::Protocols::MSC
136
138
  end
137
139
  break unless ctx[:run]
138
140
  end
141
+ rescue StandardError
142
+ @http_lock.unlock if @http_lock.owned?
139
143
  end
140
144
  # rubocop:enable Metrics/BlockLength
141
145
 
@@ -46,7 +46,9 @@ module MatrixSdk
46
46
  attr_reader :api
47
47
 
48
48
  def respond_to_missing?(name, *_args)
49
- key? name
49
+ return true if key? name
50
+
51
+ super
50
52
  end
51
53
 
52
54
  def method_missing(name, *args)