check for a nil return value from write(), fixes #4329

git-svn-id: file:///home/svn/framework3/trunk@12528 4d416f70-5f16-0410-b530-b9f4589650da
unstable
James Lee 2011-05-03 06:55:15 +00:00
parent eb2c0a5919
commit e621828cac
1 changed files with 7 additions and 5 deletions

View File

@ -148,7 +148,6 @@ protected
closed = true
wlog("monitor_rsock: closed remote socket due to nil read")
end
rescue ::Exception
closed = true
wlog("monitor_rsock: exception during read: #{e.class} #{e}")
@ -170,10 +169,13 @@ protected
# This way we naturally perform a resend if a failure occured.
# Catches an edge case with meterpreter TCP channels where remote send
# failes gracefully and a resend is required.
if( sent > 0 )
if (sent.nil? or sent <= 0)
wlog("monitor_rsock: failed writing, socket must be dead")
break
else
total_sent += sent
end
rescue ::IOError => e
rescue ::IOError, ::EOFError => e
closed = true
wlog("monitor_rsock: exception during write: #{e.class} #{e}")
break