Commit a08e4ad6fc1eb4efde4cde09f1ce0b4082ab14f9
1 parent
9d491b79
Exists in
master
and in
29 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,6 +15,7 @@ gem 'thin' | ||
15 | gem 'hpricot' | 15 | gem 'hpricot' |
16 | gem 'nokogiri' | 16 | gem 'nokogiri' |
17 | gem 'rake', :require => false | 17 | gem 'rake', :require => false |
18 | +gem 'rest-client' | ||
18 | 19 | ||
19 | # FIXME list here all actual dependencies (i.e. the ones in debian/control), | 20 | # FIXME list here all actual dependencies (i.e. the ones in debian/control), |
20 | # with their GEM names (not the Debian package names) | 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,7 +4,6 @@ require 'rexml/document' | ||
4 | require 'base64' | 4 | require 'base64' |
5 | require 'hpricot' | 5 | require 'hpricot' |
6 | require 'timeout' | 6 | require 'timeout' |
7 | -require 'system_timer' | ||
8 | 7 | ||
9 | class RubyBOSH | 8 | class RubyBOSH |
10 | BOSH_XMLNS = 'http://jabber.org/protocol/httpbind' | 9 | BOSH_XMLNS = 'http://jabber.org/protocol/httpbind' |
@@ -15,7 +14,7 @@ class RubyBOSH | @@ -15,7 +14,7 @@ class RubyBOSH | ||
15 | CLIENT_XMLNS = 'jabber:client' | 14 | CLIENT_XMLNS = 'jabber:client' |
16 | 15 | ||
17 | class Error < StandardError; end | 16 | class Error < StandardError; end |
18 | - class Timeout < RubyBOSH::Error; end | 17 | + class TimeoutError < RubyBOSH::Error; end |
19 | class AuthFailed < RubyBOSH::Error; end | 18 | class AuthFailed < RubyBOSH::Error; end |
20 | class ConnFailed < RubyBOSH::Error; end | 19 | class ConnFailed < RubyBOSH::Error; end |
21 | 20 | ||
@@ -134,12 +133,12 @@ class RubyBOSH | @@ -134,12 +133,12 @@ class RubyBOSH | ||
134 | end | 133 | end |
135 | 134 | ||
136 | def deliver(xml) | 135 | def deliver(xml) |
137 | - SystemTimer.timeout(@timeout) do | 136 | + Timeout::timeout(@timeout) do |
138 | send(xml) | 137 | send(xml) |
139 | recv(RestClient.post(@service_url, xml, @headers)) | 138 | recv(RestClient.post(@service_url, xml, @headers)) |
140 | end | 139 | end |
141 | rescue ::Timeout::Error => e | 140 | rescue ::Timeout::Error => e |
142 | - raise RubyBOSH::Timeout, e.message | 141 | + raise RubyBOSH::TimeoutError, e.message |
143 | rescue Errno::ECONNREFUSED => e | 142 | rescue Errno::ECONNREFUSED => e |
144 | raise RubyBOSH::ConnFailed, "could not connect to #{@host}\n#{e.message}" | 143 | raise RubyBOSH::ConnFailed, "could not connect to #{@host}\n#{e.message}" |
145 | rescue Exception => e | 144 | rescue Exception => e |