stompgem / stomp

A ruby gem for sending and receiving messages from a Stomp protocol compliant message queue. Includes: failover logic, ssl support.
http://stomp.github.com
Apache License 2.0
152 stars 80 forks source link

Always log connection attempts via on_connecting #31

Closed ripienaar closed 12 years ago

ripienaar commented 12 years ago

Prior to this commit the on_connect logger would only be called on initialize, not later on during reconnects such as those initiated during managing a reliable connection:

`on_connecting' Connection attempt 0 to stomp://rip@stomp:6162
`on_connectfail' Connection to stomp://rip@stomp:6162 failed on attempt 0
`on_connected' Conncted to stomp://rip@stomp:6163

Here a 2nd connection attempt was made to the failover connection that was defined in the pool but never logged

With this commit we now log at each attempt to reconnect the sockets instead so we get:

`on_connecting' Connection attempt 0 to stomp://rip@stomp:6162
`on_connectfail' Connection to stomp://rip@stomp:6162 failed on attempt 0
`on_connecting' Connection attempt 1 to stomp://rip@stomp:6163
`on_connected' Conncted to stomp://rip@stomp:6163
ripienaar commented 12 years ago

Wooh just noticed I also accidentally fixed a ton of trailing whitespace, my editor does that automatically, hope you dont mind :)

gmallard commented 12 years ago

No problem with the whitespace.

I understand and approve of what you are attempting.

My current observation of the code as is: when you run an SSL connect, you get two back-to-back calls to 'on_connecting'.

Can we try to figure out how to avoid that?

ripienaar commented 12 years ago

D'oh, I did not notice open_ssl_socket uses open_tcp_socket so I just removed the logging from open_ssl_socket and that does the right thing by the looks of it.