Changeset 607
- Timestamp:
- 12/05/07 10:10:44 (1 year ago)
- Files:
-
- version_0/lib/pr_eventmachine.rb (modified) (4 diffs)
- version_0/tests/test_pure.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
version_0/lib/pr_eventmachine.rb
r606 r607 178 178 179 179 # #get_outbound_data_size 180 # 180 181 def get_outbound_data_size sig 181 182 r = Reactor.instance.get_selectable( sig ) or raise "unknown get_outbound_data_size target" … … 183 184 end 184 185 186 # #set_comm_inactivity_timeout 187 # 188 def set_comm_inactivity_timeout sig, tm 189 r = Reactor.instance.get_selectable( sig ) or raise "unknown set_comm_inactivity_timeout target" 190 p "?????????????" # TODO, IMPLEMENT THIS. 191 end 185 192 end 186 193 … … 479 486 rescue Errno::EAGAIN 480 487 # no-op 481 rescue Errno::ECONNRESET, E OFError488 rescue Errno::ECONNRESET, Errno::ECONNREFUSED, EOFError 482 489 @close_scheduled = true 483 490 EventMachine::event_callback uuid, ConnectionUnbound, nil … … 594 601 if @pending 595 602 @pending = false 596 EventMachine::event_callback uuid, ConnectionCompleted, "" 603 if 0 == io.getsockopt(Socket::SOL_SOCKET, Socket::SO_ERROR).unpack("i").first 604 EventMachine::event_callback uuid, ConnectionCompleted, "" 605 end 597 606 else 598 607 super version_0/tests/test_pure.rb
r605 r607 71 71 72 72 73 74 # Under some circumstances, the pure Ruby library would emit an Errno::ECONNREFUSED 75 # exception on certain kinds of TCP connect-errors. 76 # It's always been something of an open question whether EM should throw an exception 77 # in these cases but the defined answer has always been to catch it the unbind method. 78 # With a connect failure, the latter will always fire, but connection_completed will 79 # never fire. So even though the point is arguable, it's incorrect for the pure Ruby 80 # version to throw an exception. 81 module TestConnrefused 82 def unbind 83 EM.stop 84 end 85 def connection_completed 86 raise "should never get here" 87 end 88 end 89 def test_connrefused 90 EM.run { 91 EM.connect "0.0.0.0", 60001, TestConnrefused 92 } 93 end 94 95 96 # Make sure connection_completed gets called as expected with TCP clients. This is the 97 # opposite of test_connrefused. 98 # If the test fails, it will hang because EM.stop never gets called. 99 # 100 module TestConnaccepted 101 def connection_completed 102 EM.stop 103 end 104 end 105 def test_connaccepted 106 timeout = false 107 EM.run { 108 EM.start_server "0.0.0.0", 60002 109 EM.connect "0.0.0.0", 60002, TestConnaccepted 110 EM::Timer.new(1) {timeout = true; EM.stop} 111 } 112 assert_equal( false, timeout ) 113 end 114 73 115 end
