lib/rex/post/meterpreter/packet_dispatcher.rb in librex-0.0.32 vs lib/rex/post/meterpreter/packet_dispatcher.rb in librex-0.0.33
- old
+ new
@@ -58,23 +58,29 @@
add_response_waiter(packet, completion_routine, completion_param)
end
bytes = 0
raw = packet.to_r
+ err = nil
if (raw)
+
begin
bytes = self.sock.write(raw)
rescue ::Exception => e
+ err = e
+ end
+
+ if bytes.to_i == 0
# Mark the session itself as dead
self.alive = false
# Indicate that the dispatcher should shut down too
@finish = true
# Reraise the error to the top-level caller
- raise e
+ raise err if err
end
end
return bytes
end
@@ -111,10 +117,10 @@
def send_packet_wait_response(packet, t)
# First, add the waiter association for the supplied packet
waiter = add_response_waiter(packet)
# Transmit the packet
- if (send_packet(packet) <= 0)
+ if (send_packet(packet).to_i <= 0)
# Remove the waiter if we failed to send the packet.
remove_response_waiter(waiter)
return nil
end