fizx-proxymachine 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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.4.0'
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
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: fizx-proxymachine
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.4.0
5
+ version: 1.5.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tom Preston-Werner