remailer 0.4.10 → 0.4.11

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.10
1
+ 0.4.11
@@ -98,7 +98,7 @@ class Remailer::Connection < EventMachine::Connection
98
98
  end
99
99
 
100
100
  # Handles callbacks driven by exceptions before an instance could be created.
101
- def self.report_exception(e)
101
+ def self.report_exception(e, options)
102
102
  case (options[:connect])
103
103
  when Proc
104
104
  options[:connect].call(false, e.to_s)
@@ -159,6 +159,7 @@ class Remailer::Connection < EventMachine::Connection
159
159
  reset_timeout!
160
160
 
161
161
  if (using_proxy?)
162
+ @connecting_to_proxy = true
162
163
  use_socks5_interpreter!
163
164
  else
164
165
  use_smtp_interpreter!
@@ -266,28 +267,41 @@ class Remailer::Connection < EventMachine::Connection
266
267
  @timeout = DEFAULT_TIMEOUT if (@timeout <= 0)
267
268
  end
268
269
 
270
+ def proxy_connection_initiated
271
+ @connecting_to_proxy = false
272
+ end
273
+
269
274
  # This implements the EventMachine::Connection#completed method by
270
275
  # flagging the connection as estasblished.
271
276
  def connection_completed
272
- @timeout_at = nil
277
+ reset_timeout!
273
278
  end
274
279
 
275
280
  # This implements the EventMachine::Connection#unbind method to capture
276
281
  # a connection closed event.
277
282
  def unbind
278
283
  return if (@unbound)
279
-
280
- @connected = false
281
- @unbound = true
282
- @interpreter = nil
283
284
 
285
+ @unbound = true
286
+
284
287
  if (@active_message)
288
+ debug_notification(:disconnect, "Disconnected by remote before transaction could be completed.")
289
+
285
290
  if (callback = @active_message[:callback])
286
291
  callback.call(nil)
292
+
287
293
  @active_message = nil
288
294
  end
295
+ elsif (@closed)
296
+ debug_notification(:disconnect, "Disconnected from remote.")
297
+ else
298
+ debug_notification(:disconnect, "Disconnected by remote while connection was idle.")
289
299
  end
290
-
300
+
301
+ @connected = false
302
+ @timeout_at = nil
303
+ @interpreter = nil
304
+
291
305
  send_callback(:on_disconnect)
292
306
  end
293
307
 
@@ -391,15 +405,15 @@ class Remailer::Connection < EventMachine::Connection
391
405
  send_callback(:on_error)
392
406
  elsif (!@connected)
393
407
  remote_options = @options
408
+ interpreter = @interpreter
394
409
 
395
- case (@interpreter)
396
- when Remailer::Connection::Socks5Interpreter
410
+ if (@connecting_to_proxy)
397
411
  remote_options = @options[:proxy]
398
412
  end
399
413
 
400
414
  message = "Timed out before a connection could be established to #{remote_options[:host]}:#{remote_options[:port]}"
401
415
 
402
- if (interpreter = @interpreter)
416
+ if (interpreter)
403
417
  message << " using #{interpreter.label}"
404
418
  end
405
419
 
@@ -522,7 +536,10 @@ class Remailer::Connection < EventMachine::Connection
522
536
  @connected = code
523
537
 
524
538
  send_notification(:connect, code, message || self.remote)
525
- send_callback(:on_connect) if (code)
539
+
540
+ if (code)
541
+ send_callback(:on_connect)
542
+ end
526
543
  end
527
544
 
528
545
  def error_notification(code, message)
@@ -35,12 +35,6 @@ class Remailer::Connection::Socks5Interpreter < Remailer::Interpreter
35
35
  # == State Mapping ========================================================
36
36
 
37
37
  state :initialized do
38
- enter do
39
- enter_state(:connect_to_proxy)
40
- end
41
- end
42
-
43
- state :connect_to_proxy do
44
38
  enter do
45
39
  proxy_options = delegate.options[:proxy]
46
40
 
@@ -91,6 +85,8 @@ class Remailer::Connection::Socks5Interpreter < Remailer::Interpreter
91
85
 
92
86
  state :connect_through_proxy do
93
87
  enter do
88
+ delegate.proxy_connection_initiated
89
+
94
90
  if (@destination_address)
95
91
  delegate.debug_notification(:proxy, "Sending proxy connection request to #{@destination_address.unpack('CCCC').join('.')}:#{delegate.options[:port]}")
96
92
 
data/remailer.gemspec CHANGED
@@ -5,10 +5,10 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{remailer}
8
- s.version = "0.4.10"
8
+ s.version = "0.4.11"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = [%q{Scott Tadman}]
11
+ s.authors = ["Scott Tadman"]
12
12
  s.date = %q{2011-07-05}
13
13
  s.description = %q{EventMachine SMTP Mail User Agent}
14
14
  s.email = %q{scott@twg.ca}
@@ -37,8 +37,8 @@ Gem::Specification.new do |s|
37
37
  "test/unit/remailer_test.rb"
38
38
  ]
39
39
  s.homepage = %q{http://github.com/twg/remailer}
40
- s.require_paths = [%q{lib}]
41
- s.rubygems_version = %q{1.8.5}
40
+ s.require_paths = ["lib"]
41
+ s.rubygems_version = %q{1.5.3}
42
42
  s.summary = %q{Reactor-Ready SMTP Mailer}
43
43
  s.test_files = [
44
44
  "test/config.example.rb",
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: remailer
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.10
5
+ version: 0.4.11
6
6
  platform: ruby
7
7
  authors:
8
8
  - Scott Tadman
@@ -10,7 +10,8 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-05 00:00:00 Z
13
+ date: 2011-07-05 00:00:00 -04:00
14
+ default_executable:
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: eventmachine
@@ -51,6 +52,7 @@ files:
51
52
  - test/unit/remailer_interpreter_state_proxy_test.rb
52
53
  - test/unit/remailer_interpreter_test.rb
53
54
  - test/unit/remailer_test.rb
55
+ has_rdoc: true
54
56
  homepage: http://github.com/twg/remailer
55
57
  licenses: []
56
58
 
@@ -74,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
76
  requirements: []
75
77
 
76
78
  rubyforge_project:
77
- rubygems_version: 1.8.5
79
+ rubygems_version: 1.5.3
78
80
  signing_key:
79
81
  specification_version: 3
80
82
  summary: Reactor-Ready SMTP Mailer