Major Update:
- Minor fix: Set correct names in comments at top of file - New FileCore Class: - Writing data to output file - BufferCore: - Check for "EAGAIN" on write and retry write - FunctionCore: - Add new Output method that references LocalIO directly - SelectableCore: - New method SetAutomanage to specify auto re-open parameters - Re-open timer implemented to slow re-open events - Only call ProcessBuffer() if data received on socket - Force processing input data when no input marker set - Use new Output method to simplify code - Bug fix: Read correctly from buffer on multiple reads/writes on FD - Check for "EAGAIN" on write to FD and retry write
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -310,8 +311,9 @@ int CBuffer::ReadFromFD( int Handle, int MaxRead )
|
||||
// Read from file descriptor
|
||||
BufRemain = BufSize - BufEnd;
|
||||
BytesRead = read( Handle, &Buffer[BufEnd], ((BufRemain > DataRemain)? DataRemain : BufRemain) );
|
||||
if (BytesRead <= 0)
|
||||
if (BytesRead <= 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Update Buffer Pointers
|
||||
DataRemain -= BytesRead;
|
||||
@@ -328,7 +330,6 @@ int CBuffer::ReadFromFD( int Handle, int MaxRead )
|
||||
BufStart = BufEnd;
|
||||
}
|
||||
}
|
||||
|
||||
return TotalRead;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -355,8 +356,9 @@ int CBuffer::WriteToFD( int Handle, int MaxLen )
|
||||
// Read from file descriptor
|
||||
BufRemain = BufSize - ReadPos;
|
||||
BytesWritten = write( Handle, &Buffer[ReadPos], ((BufRemain > DataRemain)? DataRemain : BufRemain) );
|
||||
if (BytesWritten <= 0)
|
||||
if ((BytesWritten <= 0) && (errno != EAGAIN)) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Update Data Pointers
|
||||
TotalWritten += BytesWritten;
|
||||
|
||||
Reference in New Issue
Block a user