-
Notifications
You must be signed in to change notification settings - Fork 87
Remove the on_error callback system, fix error handling #37
Conversation
@@ -65,9 +65,8 @@ def read_every(n, unit = :s) | |||
def read | |||
@parser.append @socket.readpartial(Connection::BUFFER_SIZE) until msg = @parser.next_message | |||
msg | |||
rescue => e | |||
ensure | |||
cancel_timer! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a semantic change here.
The timer previously was only canceled when an exception was raised.
uh-oh, seems that's me who got rid of |
regard
any clues on how to carefully implement this for |
@Silvu well first, I want to thank you for all your great contributions to Reel. This is one minor issue that slipped by. You're right that EventMachine uses callbacks for this, but it's because it has no option but to do otherwise as its entire mode of operation is completely callback driven. I'm not opposed to Reel having a callback-based error handler, but your change completely subsumed the exception-based behavior and in the process broke error handling when clients disconnected. I'd like to remove this API for now and perhaps discuss how a similar API could be done. |
well, sure, i do not insist to keep will cleanup examples of |
The timer changes in d343e4e is the point of reference. @slivu could you comment on that? |
well, the idea was to cancel timer once client unable to read/write to socket, |
OK, I will make the code behave like that. |
This callback-based exception handler both duplicates and breaks the exception-based exception handling that was previously in place in Reel. It seems it was added without a great deal of care, because many of the examples are now crashing. It seems more test coverage is probably in order, but that said, Reel should not use a system like this, and it broke proper Errno::EPIPE handling for closed connections.
@slivu @tarcieri how does that last commit look? |
Remove the on_error callback system, fix error handling
This callback-based exception handler both duplicates and breaks the
exception-based exception handling that was previously in place in Reel.
It seems it was added without a great deal of care, because many of the
examples are now crashing.
It seems more test coverage is probably in order, but that said, Reel
should not use a system like this, and it broke proper Errno::EPIPE
handling for closed connections.