aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/udp_server.rb
diff options
context:
space:
mode:
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