Minor Update:

- BufferCore:
  - Method WriteToFD should ignore EAGAIN
- LogCore:
  - Add OUT_COUNT output bit (show total output bytes)
- SelectableCore:
  - Add Force param on WriteToFD, ignore EAGAIN if !Force
This commit is contained in:
Charl Wentzel
2016-07-27 13:42:50 +02:00
parent 1a9f825b25
commit eaace97ec9
6 changed files with 44 additions and 23 deletions

View File

@@ -851,7 +851,7 @@ bool CSelectableCore::Write( THandle * Handle )
{
if (Handle->OutBuffer)
{
// Write to FD directly from buffer
// Write to FD directly from output buffer
if ((BytesWritten = Handle->OutBuffer->WriteToFD( Handle->FD )))
{
if (DebugLevel >= dlHigh) {
@@ -874,7 +874,7 @@ bool CSelectableCore::Write( THandle * Handle )
}
else
{
// No Output buffer, so remove from Write list
// No Output buffer to write from, so remove from Write list
if (Select) {
Select->Remove( Handle->FD, false, true );
}
@@ -967,7 +967,7 @@ int CSelectableCore::ReadFromFD( int FD, char * Data, int MaxLen )
}
//---------------------------------------------------------------------------
int CSelectableCore::WriteToFD( int FD, const char * Data, int Len )
int CSelectableCore::WriteToFD( int FD, const char * Data, int Len, bool Force )
{
int BytesWritten = 0;
int TotalWritten = 0;
@@ -984,7 +984,7 @@ int CSelectableCore::WriteToFD( int FD, const char * Data, int Len )
{
// Read from file descriptor
BytesWritten = write( FD, &Data[TotalWritten], DataRemain );
if ((BytesWritten <= 0) && (errno != EAGAIN)) {
if ((BytesWritten <= 0) && (!Force || (errno != EAGAIN))) {
break;
}
@@ -1050,11 +1050,11 @@ int CSelectableCore::Input( const char * IOName, const char * Data, int Len )
}
else
{
// Write directly to handle
BytesWritten = WriteToFD( ChildHandle->FD, Data, Len, true );
// Show event
ShowOutput( DebugLevel, dlHigh, OutputDisplay, Data, Len, "%s: Handle '%s' - OUT:", Name, ChildHandle->Name );
// Write directly to handle
BytesWritten = WriteToFD( ChildHandle->FD, Data, Len );
}
}
// Next
@@ -1083,7 +1083,7 @@ int CSelectableCore::Input( const char * IOName, const char * Data, int Len )
ShowOutput( DebugLevel, dlHigh, OutputDisplay, Data, Len, "%s: Handle '%s' - OUT:", Name, Handle->Name );
// Write directly to handle
BytesWritten = WriteToFD( Handle->FD, Data, Len );
BytesWritten = WriteToFD( Handle->FD, Data, Len, true );
}
}