selfsdk 0.0.165 → 0.0.166

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/messaging.rb +16 -16
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c98f4bd8df938f9c11acb72ffef83f231ddd0c1466c2b507975c5c3f1e4a8b58
4
- data.tar.gz: 15109c43f84455b30215b905fdfa556a286a97e04da9c18e0ea7ae24bc69eecc
3
+ metadata.gz: 8c85c6fa67915d806be363e234ac87b2bdffc6d331a48a273f48f737bb476fa6
4
+ data.tar.gz: fadf3e8a7df24cb74b71fc0e695f647b94510afb4092e58ca86f9aa6e0d2deaa
5
5
  SHA512:
6
- metadata.gz: 747b1019940113d76d2b2bf6e5b0fe39a7178f12dedabaa5b555b71aefdfe8e60d0dbe2658b467151a4df8985c48d695dcc622f2a4583ac28491190159c0a183
7
- data.tar.gz: c8755a17be9aeed3d189b9116ad189c4e2bb24de1f9af594c1fe1196abad63ba24a1295958e2183e0845fcaf7a29592b62608440415198fa334efa36f8752534
6
+ metadata.gz: dfc07013f91c98b460991df709e4526fe86ee37d6f26818d87fe3c29c10c99ec69401d1c51a1f7ab80f1a7bad1248ce81cb7091fa469d584863d962e6c39effa
7
+ data.tar.gz: 7f3455f82fd7a2dec5579dd67d4a43a80ffc3fb24b35f90f7ab82bffd86d264e8760154decc7119ffc9c9fc6976669f2804f0f8222c7f52a6a0e4ebe55496cc5
data/lib/messaging.rb CHANGED
@@ -286,6 +286,14 @@ module SelfSDK
286
286
  @acks["authentication"][:waiting_cond].wait_while { @acks["authentication"][:waiting] }
287
287
  @acks.delete("authentication")
288
288
  end
289
+ # In case this does not succeed start the process again.
290
+ if @acks.include? 'authentication'
291
+ if @acks['authentication'][:waiting]
292
+ close
293
+ start_connection
294
+ end
295
+ @acks.delete("authentication")
296
+ end
289
297
  end
290
298
 
291
299
  # Cleans expired messages
@@ -404,22 +412,14 @@ module SelfSDK
404
412
 
405
413
  # Authenticates current client on the websocket server.
406
414
  def authenticate
407
- res = wait_for 'authentication' do
408
- SelfSDK.logger.info "authenticating"
409
- send_raw Msgproto::Auth.new(
410
- type: Msgproto::MsgType::AUTH,
411
- id: "authentication",
412
- token: @jwt.auth_token,
413
- device: @device_id,
414
- offset: @offset,
415
- )
416
- end
417
-
418
- return res unless res.nil?
419
-
420
- SelfSDK.logger.info "authentication timed out, retrying ..."
421
- close
422
- start_connection
415
+ SelfSDK.logger.info "authenticating"
416
+ send_raw Msgproto::Auth.new(
417
+ type: Msgproto::MsgType::AUTH,
418
+ id: "authentication",
419
+ token: @jwt.auth_token,
420
+ device: @device_id,
421
+ offset: @offset,
422
+ )
423
423
  end
424
424
 
425
425
  def send_raw(msg)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selfsdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.165
4
+ version: 0.0.166
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aldgate Ventures