mattvperry / mumble-ruby

A headless mumble client API written in Ruby
MIT License
126 stars 34 forks source link

Bot disconnecting after 10 seconds #44

Open nicolasjoly opened 9 years ago

nicolasjoly commented 9 years ago

My bot randomly disconnects from the server after about 10 seconds he's been online. The server is running the latest snapshot 1.3.0~537~gf8b63cd~snapshot, so it's using OPUS

I did the following to install your bot: sudo apt-get install ruby1.9.1-full sudo apt-get install make sudo gem install mumble-ruby sudo apt-get install libopus-dev

And I start it like this: irb1.9.1 require 'mumble-ruby' cli = Mumble::Client.new('MY_IP', 64738, 'Botty', 'MY_PASSWORD') cli.connect

irb(main):001:0> require 'mumble-ruby' => true irb(main):002:0> cli = Mumble::Client.new('MY_IP', 64738, 'Botty', 'MY_PASSWORD') => #Mumble::Client:0x000000022aacb8 @channels={}, @users={}, @callbacks={}, @config=#Hashie::Mash bitrate=32000 host="MY_IP" password="MY_PASSWORD" port=64738 sample_rate=48000 ssl_cert_opts=#Hashie::Mash cert_dir="/var/lib/gems/1.9.1/gems/mumble-ruby-1.1.2/lib" country_code="US" organization="github.com" organization_unit="Engineering"> username="Botty">> irb(main):003:0> cli.connect => false

Is the "=>false" after "cli.connect" normal? Then after around 10 seconds

irb(main):004:0> /var/lib/gems/1.9.1/gems/mumble-ruby-1.1.2/lib/mumble-ruby/connection.rb:29:in read_message': undefined methodunpack' for nil:NilClass (NoMethodError) from /var/lib/gems/1.9.1/gems/mumble-ruby-1.1.2/lib/mumble-ruby/client.rb:121:in read' from /var/lib/gems/1.9.1/gems/mumble-ruby-1.1.2/lib/mumble-ruby/thread_tools.rb:8:inblock (2 levels)in spawn_thread' from /var/lib/gems/1.9.1/gems/mumble-ruby-1.1.2/lib/mumble-ruby/thread_tools.rb:8:in loop' from /var/lib/gems/1.9.1/gems/mumble-ruby-1.1.2/lib/mumble-ruby/thread_tools.rb:8:inblock in spawn_thread'

Here's the log from my server:

2015-02-11 18:28:07.138 1 => CELT codec switch ffffffff8000000b ffffffff80000010 (prefer ffffffff80000010) (Opus 1) 2015-02-11 18:28:07.136 1 => <2:Botty(-1)> Connection closed: [-1] 2015-02-11 18:28:07.132 1 => <2:Botty(-1)> Timeout 2015-02-11 18:27:28.704 1 => <2:Botty(-1)> Authenticated 2015-02-11 18:27:28.701 1 => CELT codec switch ffffffff8000000b 0 (prefer ffffffff8000000b) (Opus 1) 2015-02-11 18:27:28.664 1 => <2:(-1)> Client version 1.2.7 (Linux: mumble-ruby 1.1.2) 2015-02-11 18:27:28.639 1 => <2:(-1)> New connection: MY_IP:53632

I tried recording stuff using the recording command and everything works, he still disconnects after 10sec.

dafoxia commented 9 years ago

A false direct after cli.connect is normal. After a few moments cli.connected? should :-) return true.

timaely commented 9 years ago

I had a very similar error. I changed sleep(20) to sleep(10) in the ping method in client.rb and it seems fine now.

nicolasjoly commented 9 years ago

Wow I tried so many stuff...but this worked, thanks!

MPW1412 commented 6 years ago

Changing the timeout didn't work for me. Any ideas?