Fix some bad copypasta from non-blocking write commit. This should make stream sessions happy again.

git-svn-id: file:///home/svn/framework3/trunk@12476 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2011-04-30 04:25:42 +00:00
parent 321e5bd292
commit 20c949d1fb
1 changed files with 21 additions and 3 deletions

View File

@ -68,19 +68,33 @@ module StreamAbstraction
end
#
# Writes to the local side.
# Low-level write to the local side.
#
def syswrite(buffer)
lsock.syswrite(buffer)
end
#
# Reads from the local side.
# Writes to the local side.
#
def write(buffer)
lsock.write(buffer)
end
#
# Low-level read from the local side.
#
def sysread(length)
lsock.sysread(length)
end
#
# Reads from the local side.
#
def read(length)
lsock.read(length)
end
#
# Shuts down the local side of the stream abstraction.
#
@ -161,8 +175,12 @@ protected
while( total_sent < total_length )
begin
data = buf[total_sent, buf.length]
# Note that this must be write() NOT syswrite() or put() or anything like it.
# Using syswrite() breaks SSL streams.
sent = self.write( data )
# sf: Only remove the data off the queue is syswrite was successfull.
# sf: Only remove the data off the queue is write was successfull.
# 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.