Permalink
Browse files

switch to new nestable EM.run in EM 0.12.1

  • Loading branch information...
tmm1 committed Jun 17, 2008
1 parent 6ffb457 commit 7a606938a6c76c7c15bb0cc58ce2923c8dc0e38c
Showing with 3 additions and 31 deletions.
  1. +1 −2 README
  2. +0 −27 em.rb
  3. +2 −2 xmpp4em.rb
View
3 README
@@ -1,4 +1,3 @@
Simple XMPP client built on EventMachine.
-Requires eventmachine-xmlpushparser. To install on OSX:
- gem install eventmachine-xmlpushparser -- --with-xml2-include=/usr/include/libxml2
+Requires eventmachine-xmlpushparser (in vendor/) and eventmachine 0.12.1
View
27 em.rb
@@ -1,31 +1,4 @@
require 'rubygems'
require 'eventmachine'
-
-module EventMachine
- def self.start(background = nil, &block)
- if EM::reactor_running?
- # Attention: here we loose the ability to catch
- # immediate connection errors.
- EM::next_tick(&block)
- sleep unless background # this blocks the thread as it was inside a reactor
- else
- if background
- Thread.abort_on_exception = true
- $em_reactor_thread = Thread.new do
- EM::old_run(&block)
- end
- else
- EM::old_run(&block)
- end
- end
- end
-
- class << self
- alias :old_run :run
- alias :run :start
- end unless EM.respond_to? :old_run
-end
-
require 'evma_xmlpushparser'
-
EM.epoll
View
@@ -171,12 +171,12 @@ def jid
end
def connect host = jid.domain, port = 5222
- EM.run(true) do
+ EM.run {
EM.connect host, port, Connection, host do |conn|
@connection = conn
conn.client = self
end
- end
+ }
end
def connected?

0 comments on commit 7a60693

Please sign in to comment.