local_tunnel 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/local_tunnel.rb +23 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96c12f590b7b9d79fd509c9ec3325baaee4a2533
|
4
|
+
data.tar.gz: 9ee604bcb6ce9820519d01ba77d046534567e531
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17db5e979202f9a959da3b65eee3a699f6a680a8942529e82efb8f58c01bc5a0f1b2c4346d1fa117a8883acb945fc5676ccf27771a1fa81b4ec6b74037b89f1a
|
7
|
+
data.tar.gz: c90b9ef592b97c4eea1d148876ccd09e6e457a2e13133a2cae11ae01c067b8e9e5aa5fd076cd7c62bb71c19653f0955beef2bd9f14dc93ab754ec36879d26daa
|
data/lib/local_tunnel.rb
CHANGED
@@ -32,13 +32,19 @@ module LocalTunnel
|
|
32
32
|
def start
|
33
33
|
@rconn = rconnect
|
34
34
|
@lconn = lconnect
|
35
|
+
bail = false
|
35
36
|
|
36
37
|
@lrthr = Thread.new do
|
37
38
|
buf = String.new(capacity: 1024)
|
38
|
-
|
39
|
+
until bail
|
39
40
|
begin
|
40
41
|
logger.debug(format("%03d lr: attempting read", @id))
|
41
42
|
@lconn.readpartial(1024, buf)
|
43
|
+
rescue Errno::ECONNRESET
|
44
|
+
logger.debug(format("%03d lr: read failed, connection reset by peer", @id))
|
45
|
+
@lconn.close
|
46
|
+
bail = true
|
47
|
+
break
|
42
48
|
rescue EOFError
|
43
49
|
logger.debug(format("%03d lr: read failed, reconnecting", @id))
|
44
50
|
@lconn.close
|
@@ -50,6 +56,11 @@ module LocalTunnel
|
|
50
56
|
begin
|
51
57
|
logger.debug(format("%03d lr: attempting write", @id))
|
52
58
|
s = @rconn.write(buf)
|
59
|
+
rescue Errno::ECONNRESET
|
60
|
+
logger.debug(format("%03d lr: write failed, connection reset by peer", @id))
|
61
|
+
@lconn.close
|
62
|
+
bail = true
|
63
|
+
break
|
53
64
|
rescue IOError
|
54
65
|
logger.debug(format("%03d lr: write failed, reconnecting", @id))
|
55
66
|
@rconn.close
|
@@ -66,10 +77,15 @@ module LocalTunnel
|
|
66
77
|
|
67
78
|
@rlthr = Thread.new do
|
68
79
|
buf = String.new(capacity: 1024)
|
69
|
-
|
80
|
+
until bail
|
70
81
|
begin
|
71
82
|
logger.debug(format("%03d rl: attempting read", @id))
|
72
83
|
@rconn.readpartial(1024, buf)
|
84
|
+
rescue Errno::ECONNRESET
|
85
|
+
logger.debug(format("%03d rl: read failed, connection reset by peer", @id))
|
86
|
+
@lconn.close
|
87
|
+
bail = true
|
88
|
+
break
|
73
89
|
rescue EOFError
|
74
90
|
logger.debug(format("%03d rl: read failed, reconnecting", @id))
|
75
91
|
@rconn.close
|
@@ -81,6 +97,11 @@ module LocalTunnel
|
|
81
97
|
begin
|
82
98
|
logger.debug(format("%03d rl: attempting write", @id))
|
83
99
|
s = @lconn.write(buf)
|
100
|
+
rescue Errno::ECONNRESET
|
101
|
+
logger.debug(format("%03d rl: write failed, connection reset by peer", @id))
|
102
|
+
@lconn.close
|
103
|
+
bail = true
|
104
|
+
break
|
84
105
|
rescue IOError
|
85
106
|
logger.debug(format("%03d rl: write failed, reconnecting", @id))
|
86
107
|
@lconn.close
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: local_tunnel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Loic Nageleisen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|