Switch to recvfrom_nonsock, solves a hang with win32 + 1.9.1

git-svn-id: file:///home/svn/framework3/trunk@9045 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2010-04-10 17:31:40 +00:00
parent 3ad0560d00
commit 108362cf95
1 changed files with 12 additions and 10 deletions

View File

@ -117,11 +117,12 @@ module Rex::Socket::Udp
# as [ data, host, port ].
#
def recvfrom(length = 65535, timeout=def_read_timeout)
begin
if ((rv = Kernel.select([ fd ], nil, nil, timeout)) and
(rv[0]) and (rv[0][0] == fd)
)
data, saddr = super(length)
data, saddr = recvfrom_nonblock(length)
af, host, port = Rex::Socket.from_sockaddr(saddr)
return [ data, host, port ]
@ -153,3 +154,4 @@ module Rex::Socket::Udp
end
end