jugyo / earthquake

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

Can't connect #118

Open lukaszkorecki opened 12 years ago

lukaszkorecki commented 12 years ago

It looks like an EventMachine/SSL problem, somewhat related to this issue.

So I made a little change to ext.rb:


diff --git a/lib/earthquake/ext.rb b/lib/earthquake/ext.rb                           
index 7a8a00d..c6cd966 100644                                                        
--- a/lib/earthquake/ext.rb                                                          
+++ b/lib/earthquake/ext.rb                                                          
@@ -5,12 +5,12 @@ module Twitter                                                     
       @reconnect_callback.call(timeout, @reconnect_retries) if @reconnect_callback  

       if timeout == 0                                                               
-        reconnect @options[:host], @options[:port]                                  
         start_tls if @options[:ssl]                                                 
+        reconnect @options[:host], @options[:port]                                  
       else                                                                          
         EventMachine.add_timer(timeout) do                                          
-          reconnect @options[:host], @options[:port]                                
           start_tls if @options[:ssl]                                               
+          reconnect @options[:host], @options[:port]                                
         end                                                                         
       end                                                                           
     end                                                                             

(before that earthquake would just crash with the same error as in the mentioned EM issue)

...and now I get this:

 │vagrant > lukasz: bin/earthquake [ruby-1.9.3@earthquake]  master ~/Projects/earthquake              
 │                 _   _                       _                                                      
 │  ___  __ _ _ __| |_| |__   __ _ _   _  __ _| | _____                                               
 │ / _ \/ _` | '__| __| '_ \ / _` | | | |/ _` | |/ / _ \                                              
 │|  __/ (_| | |  | |_| | | | (_| | |_| | (_| |   <  __/                                              
 │ \___|\__,_|_|   \__|_| |_|\__, |\__,_|\__,_|_|\_\___|                                              
 │                              |_|               v0.9.0                                              
 │                                                                                                    
 │1) open:                                                                                            
 https://api.twitter.com/oauth/authorize?oauth_token=csNTygR3B5ow8bT4QllWseqLAOABbqmyU9NeGpvcw        
 │Failure in opening                                                                                  
 https://api.twitter.com/oauth/authorize?oauth_token=csNTygR3B5ow8bT4QllWseqLAOABbqmyU9NeGpvcw        
 with                                                                                                 
 │options {}: Unable to find a browser command. If this is unexpected, Please                         
 rerun with environment variable LAUNCHY_DE                                                           
 │BUG=true or the '-d' commandline option and file a bug at                                           
 https://github.com/copiousfreetime/launchy/issues/new                                                
 │2) Enter the PIN: 6174205                                                                           
 │Saving 'token' and 'secret' to '/home/lukasz/.earthquake/config'                                    
 │⚡ earthquake: error: invalid status code: 401.                                                      
 │earthquake: reconnecting in: 10 seconds                                                             
 │earthquake: reconnecting in: 20 seconds                                                             
 │earthquake: reconnecting in: 40 seconds                                                             
 │earthquake: reconnecting in: 80 seconds                                                             
 │earthquake: reconnecting in: 160 seconds                                                            
 │earthquake: reconnecting in: 320 seconds                                                            

OS: Debian Squeeze Ruby 1.9.3 and 1.9.2 Earthquake version 0.8.5 and up

pengwynn commented 12 years ago

I've had no luck on 1.9.3. I'm running earthquake on 1.9.2 with a rvm wrapper:

rvm wrapper ruby-1.9.2@earthquake twitter earthquake
lukaszkorecki commented 12 years ago

I'm getting the same error on Debian with ruby 1.9.2 (I've updated the main as well). On OSX it works just fine.

no6v commented 12 years ago

Just FYI, I'm using Debian GNU/Linux unstable (x86_64), and with ruby-trunk (updating per few days), 1.9.3p125, 1.9.2p290. Everything works good for me at least with the followings:

no6v commented 12 years ago

This occured in (too ?) old environment. Hope this helps.

⚡ earthquake: reconnecting in: 10 seconds
terminate called after throwing an instance of 'std::runtime_error'
  what():  call SetTlsParms before calling StartTls
Aborted
$ ruby1.9.1 -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [i486-linux]
cola-zero commented 12 years ago

I have same problem. Here is my environments. https://gist.github.com/2437661

cola-zero commented 12 years ago

I found the source of this problem. If version of libssl is 1.0.*, earthquake (EventMachine) can't access to server using https. Then, the error occurred because it try to reconnect immediately. Notification for reconnecting are shown.

I could fix this error by install openssl via rvm and re-install ruby, as shown in README. https://gist.github.com/2576093 This is what I did.