aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/udp_server.rb
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-06-09 18:09:52 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-06-09 18:09:52 +0100
commit495c44445642cfae8f23fadde299ad5307f5be58 (patch)
tree0104c9eef164235aa5ab05b126c8f63e52fb8624 /lib/mauve/udp_server.rb
parent0c88fcc91db1b003cd5d5311f62700c7867b4099 (diff)
Big commit
--HG-- rename : views/please_authenticate.haml => views/login.haml
Diffstat (limited to 'lib/mauve/udp_server.rb')
-rw-r--r--lib/mauve/udp_server.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/mauve/udp_server.rb b/lib/mauve/udp_server.rb
index a570e8a..a873e77 100644
--- a/lib/mauve/udp_server.rb
+++ b/lib/mauve/udp_server.rb
@@ -68,11 +68,13 @@ module Mauve
#
# TODO: why is/isn't this non-block?
#
+ i = 0
begin
- # packet = @socket.recvfrom_nonblock(65535)
- packet = @socket.recvfrom(65535)
+ packet = @socket.recvfrom_nonblock(65535)
+# packet = @socket.recvfrom(65535)
received_at = MauveTime.now
- rescue Errno::EAGAIN, Errno::EWOULDBLOCK
+ rescue Errno::EAGAIN, Errno::EWOULDBLOCK => ex
+ puts "#{i += 1} + #{ex}"
IO.select([@socket])
retry unless self.should_stop?
end
@@ -99,7 +101,7 @@ module Mauve
#
# Triggers loop to close socket.
#
- UDPSocket.open.send("", 0, @socket.addr[2], @socket.addr[1]) unless @socket.closed?
+ UDPSocket.open.send("", 0, @socket.addr[2], @socket.addr[1]) unless @socket.nil? or @socket.closed?
super
end