bogo-websocket 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f654e8174cba3c2e7f53e4a1b6614253042fa8a1
4
- data.tar.gz: 90a4dad66c9712479a844cd3bed23774636deeae
3
+ metadata.gz: 21011f628e8dad6781507d7700bc567e5684efc7
4
+ data.tar.gz: f96c39374cf0d024e38039ec52472ed8ff08338e
5
5
  SHA512:
6
- metadata.gz: 144ce085ffc83667241f70077e2d713b1f6d230a2f4d586745c4b60890160807821cb1f5c1aacfdc6a34e7457867d29d04c877bea5c2f31c22984cc31e765e51
7
- data.tar.gz: c1e6d8827ccbd0cc305d24dce6f0def5bbba14e065d2409a31439e0a92e119eacc6c7621ea5b352f7cfde19d47d5316435ed14d151a720e29c24f9a8cc2b9bee
6
+ metadata.gz: 8bf34984efe86f08d81c6368464bcc9f4ff6a0405da1fbcf067284342f75343f634aec87626cc4554eebeddd041866bdc97ecca3a025114d3edc3b59c5e3a354
7
+ data.tar.gz: 7da091f8504803209e7c34c1b1f6d7e08fe2c270c445e24e01d8a07ecc5db9965ed773dfd76fa91389ba65f6d9012c82f1ad05d7590736a237151d2177a7bd63
@@ -1,3 +1,7 @@
1
+ # v0.2.0
2
+ * Reduce valid exceptions for retry
3
+ * Consistently close down socket
4
+
1
5
  # v0.1.4
2
6
  * Rescue connection resets and close gracefully
3
7
 
@@ -1,5 +1,5 @@
1
1
  module Bogo
2
2
  module Websocket
3
- VERSION = Gem::Version.new('0.1.4')
3
+ VERSION = Gem::Version.new('0.2.0')
4
4
  end
5
5
  end
@@ -61,10 +61,13 @@ module Bogo
61
61
 
62
62
  # Close the connection
63
63
  def close
64
- connection.close
65
- @die = true
66
- control_w.write 'closed'
67
- container.join
64
+ if(connection)
65
+ connection.close
66
+ @die = true
67
+ control_w.write 'closed'
68
+ container.join unless Thread.current == container
69
+ @connection = nil
70
+ end
68
71
  end
69
72
 
70
73
  # Start the reader
@@ -74,22 +77,21 @@ module Bogo
74
77
  until(die || connection.closed?)
75
78
  begin
76
79
  unless(die || connection.closed?)
77
- client << connection.read_nonblock(2046)
80
+ client << connection.read_nonblock(1024)
78
81
  if(message = client.next)
79
82
  handle_message(message)
80
83
  end
81
84
  end
82
- rescue IO::WaitReadable, EOFError, Errno::ECONNRESET
85
+ rescue IO::WaitReadable, Errno::EAGAIN => e
83
86
  unless(die || connection.closed?)
84
87
  IO.select([connection, control_r])
85
88
  retry
86
89
  end
87
90
  rescue => error
88
91
  on_error.call(error)
89
- raise
92
+ close
90
93
  end
91
94
  end
92
- @connection = nil
93
95
  end
94
96
  end
95
97
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bogo-websocket
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-28 00:00:00.000000000 Z
11
+ date: 2016-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bogo
@@ -97,3 +97,4 @@ signing_key:
97
97
  specification_version: 4
98
98
  summary: Simple websocket libraries
99
99
  test_files: []
100
+ has_rdoc: