fizx-proxymachine 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/fizx-proxymachine.gemspec +1 -1
- data/lib/proxymachine/client_connection.rb +5 -3
- metadata +1 -1
data/fizx-proxymachine.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'fizx-proxymachine'
|
16
|
-
s.version = '1.
|
16
|
+
s.version = '1.5.0'
|
17
17
|
s.date = '2011-05-07'
|
18
18
|
s.rubyforge_project = 'fizx-proxymachine'
|
19
19
|
|
@@ -55,6 +55,8 @@ class ProxyMachine
|
|
55
55
|
end
|
56
56
|
@connect_timeout = @commands[:connect_timeout]
|
57
57
|
@inactivity_timeout = @commands[:inactivity_timeout]
|
58
|
+
@connect_error_callback = @commands[:connect_error_callback]
|
59
|
+
@inactivity_error_callback = @commands[:inactivity_error_callback]
|
58
60
|
connect_to_server
|
59
61
|
elsif close = @commands[:close]
|
60
62
|
if close == true
|
@@ -103,7 +105,7 @@ class ProxyMachine
|
|
103
105
|
if @connected
|
104
106
|
$logger.error "Connection with #{@remote.join(':')} was terminated prematurely."
|
105
107
|
close_connection
|
106
|
-
ProxyMachine.connect_error_callback.call(@remote.join(':'))
|
108
|
+
(@connect_error_callback || ProxyMachine.connect_error_callback).call(@remote.join(':'))
|
107
109
|
elsif @tries < 10
|
108
110
|
@tries += 1
|
109
111
|
$logger.warn "Retrying connection with #{@remote.join(':')} (##{@tries})"
|
@@ -111,7 +113,7 @@ class ProxyMachine
|
|
111
113
|
else
|
112
114
|
$logger.error "Connect #{@remote.join(':')} failed after ten attempts."
|
113
115
|
close_connection
|
114
|
-
ProxyMachine.connect_error_callback.call(@remote.join(':'))
|
116
|
+
(@connect_error_callback || ProxyMachine.connect_error_callback).call(@remote.join(':'))
|
115
117
|
end
|
116
118
|
end
|
117
119
|
|
@@ -123,7 +125,7 @@ class ProxyMachine
|
|
123
125
|
$logger.error "Disconnecting #{@remote.join(':')} after #{elapsed}s of inactivity (> #{timeout.inspect})"
|
124
126
|
@server_side = nil
|
125
127
|
close_connection
|
126
|
-
ProxyMachine.inactivity_error_callback.call(@remote.join(':'))
|
128
|
+
(@inactivity_error_callback || ProxyMachine.inactivity_error_callback).call(@remote.join(':'))
|
127
129
|
end
|
128
130
|
|
129
131
|
def unbind
|