ruby-snmp
ruby-snmp copied to clipboard
Make recv and recvfrom non-blocking
Your UDPTransport#recv and UDPServerTransport#recvfrom both block which can cause a thread deadlock if used in the wrong way. @ryanmelt reimplemented this with non-blocking calls.
Under what circumstances does a deadlock occur? How does this patch fix it?
I believe this was working around various issues I had encountered using the blocking flavors of socket calls in Ruby. (Like: http://bugs.ruby-lang.org/issues/1805) The fix at the time was to block using select instead of directly on the recv/recvfrom call. Probably not applicable to current patched versions of ruby, but wouldn't hurt either. Up to you whether or not to incorporate.