jugyo / earthquake

Twitter terminal client with streaming API support.
MIT License
661 stars 94 forks source link

fix EventMachine function call sequence #168

Closed esotericaone closed 10 years ago

esotericaone commented 10 years ago

EventMachine what is used in twitter-stream disallows calling start_tls after you start receiving or sending data. The official document describes about it:

An appropriate place to call #start_tls is in your redefined #post_init method, or in the #connection_completed handler for an outbound connection.

In EventMachine, SslBox is set non-null value when StartTls is called, so next start_tls will calls SetTlsParms over Ruby code and it occurs C++ exception what says "call SetTlsParms before calling StartTls".

Current earthquake.gem misses correct function call sequence. This is already represented in #118. I just created this Pull Request with commentary from it.

See also: Google search: "earthquake" "call SetTlsParms before calling StartTls", Twitter search: earthquake "call SetTlsParms before calling StartTls"