ngauthier/tubesock — pull request #28 by jonathanhoskin (2014-09-02 05:05:17+00:00)
Title: Rescue Bad file descriptor in tubesock.close

Under Puma, calling `tubesock.close` programmatically causes an exception:

Exiting
/usr/local/var/rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/tubesock-0.2.3/lib/tubesock.rb:96:in `select': Bad file descriptor (Errno::EBADF)
from /usr/local/var/rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/tubesock-0.2.3/lib/tubesock.rb:96:in `each_frame'
from /usr/local/var/rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/tubesock-0.2.3/lib/tubesock.rb:63:in `block in listen'

As raised originally by @tyrbo here: https://github.com/ngauthier/tubesock/issues/23

This PR doesn't actually fix the overall problem of websockets not closing client-side, but it does at least stop Puma from crashing.