From: Yukihiro Matsumoto Date: 2008-10-06T01:33:57+09:00 Subject: Re: stream closed (IOError) --Multipart_Mon_Oct__6_01:35:40_2008-1 Content-Type: text/plain; charset=US-ASCII Hi, In message "Re: stream closed (IOError)" on Mon, 6 Oct 2008 01:10:05 +0900, "Eric Will" writes: |matz, any input on this? Since I still can not reproduce the problem, I can not say clearly, but: * timer callback may touch the socket right after it's closed. * you've mixed fork and threads, which may not work properly. * you don't need timeout.rb. try attached simpler version. matz. --Multipart_Mon_Oct__6_01:35:40_2008-1 Content-Type: application/octet-stream Content-Disposition: attachment; filename="timer.rb" Content-Transfer-Encoding: 7bit # # synapse: a small XMPP server # timers.rb: timed code execution # # Copyright (c) 2006 Eric Will # # $Id$ # # # Import required Ruby modules. # #require 'timeout' # # The Timer namespace. # module Timer class Timer @@timers = {} attr_reader :name, :time, :repeat def initialize(name, time, repeat = false, &block) @name = name @time = time.to_i @repeat = repeat @block = block @@timers[name] = self $log.xmppd.info "new timer: #{@name} every #{@time} secs" start end ###### public ###### def timers @@timers end def start if @repeat Thread.new { loop{sleep(@time); @block.call} } else Thread.new { sleep(@time); @block.call } end end end end # module Timer --Multipart_Mon_Oct__6_01:35:40_2008-1--