handle masked EOF from Rex sockets (TODO: kill that behavior)

bug/bundler_fix
Brent Cook 2017-10-27 02:29:25 -07:00
parent 85b59c87ca
commit d188982760
1 changed files with 8 additions and 3 deletions

View File

@ -27,10 +27,11 @@ class PacketParser
end
#
# Reads data from the wire and parse as much of the packet as possible.
# Reads data from the socket and parses as much of the packet as possible.
#
def recv(sock)
if self.packet.raw_bytes_required
raw = nil
if self.packet.raw_bytes_required > 0
while (raw = sock.read(self.packet.raw_bytes_required))
self.packet.add_raw(raw)
break if self.packet.raw_bytes_required == 0
@ -38,7 +39,11 @@ class PacketParser
end
if self.packet.raw_bytes_required > 0
return nil
if raw == nil
raise EOFError
else
return nil
end
end
packet = self.packet