ngauthier / tubesock

Websocket interface on Rack Hijack w/ Rails support
MIT License
620 stars 43 forks source link

Rescue Bad file descriptor in tubesock.close #28

Closed jonathanhoskin closed 10 years ago

jonathanhoskin commented 10 years ago

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.

ngauthier commented 10 years ago

Thanks!

ngauthier commented 10 years ago

Done. Thanks guys!