Skip to content

Commit

Permalink
Avoid timers were possible, lower the remaining timers.
Browse files Browse the repository at this point in the history
  • Loading branch information
eliaslevy committed Jun 11, 2012
1 parent e7f2b92 commit 3e5aa6e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions spec/tcpsocket_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def post_init
module SendAndTimedClose
def post_init
send_data "1234"
EM.add_timer(2) { self.close_connection_after_writing }
EM.add_timer(0.05) { self.close_connection_after_writing }
end
end

Expand Down Expand Up @@ -116,7 +116,7 @@ def post_init
EM::start_server('localhost', 12345, SendAndKeepOpen)
@socket = EventMachine::Synchrony::TCPSocket.new 'localhost', 12345
@blocked = true
EM.add_timer(1) { @blocked.should eq true; EM.next_tick { EM.stop } }
EM.next_tick { @blocked.should eq true; EM.next_tick { EM.stop } }
@socket.read(10)
@blocked = false
end
Expand Down Expand Up @@ -225,7 +225,7 @@ def post_init
EM::start_server('localhost', 12345, SendAndTimedClose)
@socket = EventMachine::Synchrony::TCPSocket.new 'localhost', 12345
@blocked = true
EM.add_timer(1) { @blocked.should eq true }
EM.next_tick { @blocked.should eq true }
@socket.read(10).should eq '1234'
@blocked = false
EM.stop
Expand Down Expand Up @@ -303,7 +303,7 @@ def post_init
@socket = EventMachine::Synchrony::TCPSocket.new 'localhost', 12345
@socket.recv(10)
@blocked = true
EM.add_timer(1) { @blocked.should eq true; EM.next_tick { EM.stop } }
EM.next_tick { @blocked.should eq true; EM.next_tick { EM.stop } }
@socket.recv(10)
@blocked = false
end
Expand Down Expand Up @@ -425,7 +425,7 @@ def post_init
EventMachine.synchrony do
EM::start_server('localhost', 12345, SendAndClose)
@socket = EventMachine::Synchrony::TCPSocket.new 'localhost', 12345
EM.add_timer(0.1) do
EM.add_timer(0.01) do
proc {
@socket.write("foo")
}.should raise_error(Errno::EPIPE)
Expand Down Expand Up @@ -455,7 +455,7 @@ def post_init
EventMachine.synchrony do
EM::start_server('localhost', 12345, SendAndClose)
@socket = EventMachine::Synchrony::TCPSocket.new 'localhost', 12345
EM.add_timer(0.1) do
EM.add_timer(0.01) do
proc {
@socket.send("foo",0)
}.should raise_error(Errno::EPIPE)
Expand Down

0 comments on commit 3e5aa6e

Please sign in to comment.