tubesock 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/lib/tubesock.rb +2 -2
- data/lib/tubesock/hijack.rb +2 -2
- data/lib/tubesock/version.rb +1 -1
- data/test/test_helper.rb +1 -1
- data/test/tubesock_test.rb +10 -10
- data/test/tubesocket_puma_test.rb +2 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2414128908c4b854bc84367086ef5c09c1d472d7
|
4
|
+
data.tar.gz: 8d23986a9aefc520aeb87faccd1ce28d2f96b454
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4eedd58e0c7d6f987aeaa4622c915543de76e37f8067d299d743ba6afc4ba7e598a2e5612636c312b6bb13f4a4d2a1855d5d6d3779795032d2976a15cd802737
|
7
|
+
data.tar.gz: a354b382e477aaf864443a3dbb6285c749a5ecbdc75acdbaa3554d39a44b884b121d33ae668143ad0bbe4645eb28fe3a5a605b8d061d4e9a86de80bd560db85c
|
data/.travis.yml
CHANGED
data/lib/tubesock.rb
CHANGED
@@ -130,9 +130,9 @@ class Tubesock
|
|
130
130
|
framebuffer = WebSocket::Frame::Incoming::Server.new(version: @version)
|
131
131
|
while IO.select([@socket])
|
132
132
|
if @socket.respond_to?(:recvfrom)
|
133
|
-
data,
|
133
|
+
data, _addrinfo = @socket.recvfrom(2000)
|
134
134
|
else
|
135
|
-
data,
|
135
|
+
data, _addrinfo = @socket.readpartial(2000), @socket.peeraddr
|
136
136
|
end
|
137
137
|
break if data.empty?
|
138
138
|
framebuffer << data
|
data/lib/tubesock/hijack.rb
CHANGED
@@ -27,13 +27,13 @@ module Tubesock::Hijack
|
|
27
27
|
|
28
28
|
included do
|
29
29
|
def hijack
|
30
|
-
sock = Tubesock.hijack(env)
|
30
|
+
sock = Tubesock.hijack(request.env)
|
31
31
|
yield sock
|
32
32
|
sock.onclose do
|
33
33
|
ActiveRecord::Base.clear_active_connections! if defined? ActiveRecord
|
34
34
|
end
|
35
35
|
sock.listen
|
36
|
-
render
|
36
|
+
render plain: nil, status: -1
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
data/lib/tubesock/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -53,7 +53,7 @@ class Tubesock::TestCase::TestInteraction
|
|
53
53
|
|
54
54
|
def read
|
55
55
|
framebuffer = WebSocket::Frame::Incoming::Client.new(version: version)
|
56
|
-
data,
|
56
|
+
data, _addrinfo = @client_socket.recvfrom(2000)
|
57
57
|
framebuffer << data
|
58
58
|
framebuffer.next.data
|
59
59
|
end
|
data/test/tubesock_test.rb
CHANGED
@@ -21,8 +21,8 @@ class TubesockTest < Tubesock::TestCase
|
|
21
21
|
closed = MockProc.new
|
22
22
|
|
23
23
|
interaction.tubesock do |tubesock|
|
24
|
-
tubesock.onopen
|
25
|
-
tubesock.onclose
|
24
|
+
tubesock.onopen(&opened)
|
25
|
+
tubesock.onclose(&closed)
|
26
26
|
|
27
27
|
tubesock.onmessage do |message|
|
28
28
|
tubesock.send_data "Hello #{message}"
|
@@ -44,7 +44,7 @@ class TubesockTest < Tubesock::TestCase
|
|
44
44
|
closed = MockProc.new
|
45
45
|
|
46
46
|
interaction.tubesock do |tubesock|
|
47
|
-
tubesock.onclose
|
47
|
+
tubesock.onclose(&closed)
|
48
48
|
end
|
49
49
|
|
50
50
|
# That's what Firefox sends when disconnecting.
|
@@ -62,9 +62,9 @@ class TubesockTest < Tubesock::TestCase
|
|
62
62
|
errored = MockProc.new
|
63
63
|
|
64
64
|
interaction.tubesock do |tubesock|
|
65
|
-
tubesock.onclose
|
65
|
+
tubesock.onclose(&closed)
|
66
66
|
|
67
|
-
tubesock.onerror
|
67
|
+
tubesock.onerror(&errored)
|
68
68
|
tubesock.onmessage do |message|
|
69
69
|
raise "Really really really bad error"
|
70
70
|
end
|
@@ -83,7 +83,7 @@ class TubesockTest < Tubesock::TestCase
|
|
83
83
|
closed = MockProc.new
|
84
84
|
|
85
85
|
interaction.tubesock do |tubesock|
|
86
|
-
tubesock.onclose
|
86
|
+
tubesock.onclose(&closed)
|
87
87
|
|
88
88
|
tubesock.onerror do |error, message|
|
89
89
|
tubesock.prevent_close_on_error
|
@@ -105,7 +105,7 @@ class TubesockTest < Tubesock::TestCase
|
|
105
105
|
closed = MockProc.new
|
106
106
|
|
107
107
|
interaction.tubesock do |tubesock|
|
108
|
-
tubesock.onclose
|
108
|
+
tubesock.onclose(&closed)
|
109
109
|
|
110
110
|
tubesock.onmessage do |message|
|
111
111
|
raise "Really really really bad error"
|
@@ -126,8 +126,8 @@ class TubesockTest < Tubesock::TestCase
|
|
126
126
|
messaged = MockProc.new
|
127
127
|
|
128
128
|
interaction.tubesock do |tubesock|
|
129
|
-
tubesock.onclose
|
130
|
-
tubesock.onmessage
|
129
|
+
tubesock.onclose(&closed)
|
130
|
+
tubesock.onmessage(&messaged)
|
131
131
|
end
|
132
132
|
|
133
133
|
interaction.write "Hello world"
|
@@ -143,7 +143,7 @@ class TubesockTest < Tubesock::TestCase
|
|
143
143
|
closed = MockProc.new
|
144
144
|
|
145
145
|
interaction.tubesock do |tubesock|
|
146
|
-
tubesock.onclose
|
146
|
+
tubesock.onclose(&closed)
|
147
147
|
tubesock.onopen do
|
148
148
|
raise "Error opening socket"
|
149
149
|
end
|
@@ -6,6 +6,7 @@ class MockEngine
|
|
6
6
|
def read; "data" end
|
7
7
|
def inject(data); end
|
8
8
|
def extract; end
|
9
|
+
def init?; true; end
|
9
10
|
def write(data)
|
10
11
|
1
|
11
12
|
end
|
@@ -14,6 +15,7 @@ end
|
|
14
15
|
class MockSocket < IO
|
15
16
|
def initialize; end
|
16
17
|
def close; end
|
18
|
+
def closed?; false; end
|
17
19
|
def readpartial(len); end
|
18
20
|
end
|
19
21
|
|
@@ -36,7 +38,6 @@ class TubesockPumaTest < Tubesock::TestCase
|
|
36
38
|
|
37
39
|
interaction.tubesock do |tubesock|
|
38
40
|
proc { tubesock.close }.must_be_silent
|
39
|
-
|
40
41
|
end
|
41
42
|
|
42
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tubesock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Gauthier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
148
|
version: '0'
|
149
149
|
requirements: []
|
150
150
|
rubyforge_project:
|
151
|
-
rubygems_version: 2.6.1
|
151
|
+
rubygems_version: 2.6.14.1
|
152
152
|
signing_key:
|
153
153
|
specification_version: 4
|
154
154
|
summary: Handle websocket connections via Rack and Rails 4 using concurrency
|