Commit a08e4ad6fc1eb4efde4cde09f1ce0b4082ab14f9
1 parent
9d491b79
Exists in
master
and in
22 other branches
Removes dependency of SystemTimer from ruby-bosh
Check later if a newer gem (like xmpp4r) is more suitable than ruby-bosh.
Showing
2 changed files
with
4 additions
and
4 deletions
Show diff stats
Gemfile
| ... | ... | @@ -15,6 +15,7 @@ gem 'thin' |
| 15 | 15 | gem 'hpricot' |
| 16 | 16 | gem 'nokogiri' |
| 17 | 17 | gem 'rake', :require => false |
| 18 | +gem 'rest-client' | |
| 18 | 19 | |
| 19 | 20 | # FIXME list here all actual dependencies (i.e. the ones in debian/control), |
| 20 | 21 | # with their GEM names (not the Debian package names) | ... | ... |
vendor/plugins/ruby_bosh/lib/ruby_bosh.rb
| ... | ... | @@ -4,7 +4,6 @@ require 'rexml/document' |
| 4 | 4 | require 'base64' |
| 5 | 5 | require 'hpricot' |
| 6 | 6 | require 'timeout' |
| 7 | -require 'system_timer' | |
| 8 | 7 | |
| 9 | 8 | class RubyBOSH |
| 10 | 9 | BOSH_XMLNS = 'http://jabber.org/protocol/httpbind' |
| ... | ... | @@ -15,7 +14,7 @@ class RubyBOSH |
| 15 | 14 | CLIENT_XMLNS = 'jabber:client' |
| 16 | 15 | |
| 17 | 16 | class Error < StandardError; end |
| 18 | - class Timeout < RubyBOSH::Error; end | |
| 17 | + class TimeoutError < RubyBOSH::Error; end | |
| 19 | 18 | class AuthFailed < RubyBOSH::Error; end |
| 20 | 19 | class ConnFailed < RubyBOSH::Error; end |
| 21 | 20 | |
| ... | ... | @@ -134,12 +133,12 @@ class RubyBOSH |
| 134 | 133 | end |
| 135 | 134 | |
| 136 | 135 | def deliver(xml) |
| 137 | - SystemTimer.timeout(@timeout) do | |
| 136 | + Timeout::timeout(@timeout) do | |
| 138 | 137 | send(xml) |
| 139 | 138 | recv(RestClient.post(@service_url, xml, @headers)) |
| 140 | 139 | end |
| 141 | 140 | rescue ::Timeout::Error => e |
| 142 | - raise RubyBOSH::Timeout, e.message | |
| 141 | + raise RubyBOSH::TimeoutError, e.message | |
| 143 | 142 | rescue Errno::ECONNREFUSED => e |
| 144 | 143 | raise RubyBOSH::ConnFailed, "could not connect to #{@host}\n#{e.message}" |
| 145 | 144 | rescue Exception => e | ... | ... |