Important Update:

- BufferCore:
  - Added PeekCopy and PopCopy methods
- SelectableCore:
  - Add status checking of Handle on Read and Write
  - Reject input if Handle not open
- TimingCore:
  - Added method ClearStartTime
This commit is contained in:
Charl Wentzel
2016-07-06 15:17:10 +02:00
parent 1ced40260d
commit 6fee4d0eac
5 changed files with 93 additions and 4 deletions

View File

@@ -731,7 +731,7 @@ bool CSelectableCore::Read( THandle * Handle )
int BytesWaiting = -1;
// Validate
if (!Handle) {
if (!Handle || (Handle->State == csNone) || (Handle->State == csFailed) || (Handle->State == csClosed)) {
return false;
}
@@ -808,7 +808,7 @@ bool CSelectableCore::Write( THandle * Handle )
int BytesWritten = 0;
// Validate
if (!Handle) {
if (!Handle || (Handle->State == csNone) || (Handle->State == csFailed) || (Handle->State == csClosed)) {
return false;
}
@@ -1021,6 +1021,13 @@ int CSelectableCore::Input( const char * IOName, const char * Data, int Len )
LogMessage( DebugLevel, dlHigh, "%s: Local IO '%s' - Input rejected, Input not found", Name, IOName );
return 0;
}
// Check that handle is open
else if (Handle->State != csOpen)
{
// Log event
LogMessage( DebugLevel, dlHigh, "%s: Local IO '%s' - Input rejected, Handle not Open", Name, IOName );
return 0;
}
// Log event
ShowOutput( DebugLevel, dlHigh, OutputDisplay, Data, Len, "%s: Local IO '%s' - IN:", Name, IOName );
@@ -1099,7 +1106,7 @@ bool CSelectableCore::Process()
// Auto manage handles
if (Handle->Auto && ((Handle->State == csNone) || (Handle->State == csFailed) || (Handle->State == csClosed)))
{
// Reopen handle
// Complete opening process
Open( Handle );
}
@@ -1113,7 +1120,7 @@ bool CSelectableCore::Process()
ProcessBuffer( Handle, true );
// Reset timer
SetInterval( &(Handle->InStart), 0 );
ClearStartTime( &(Handle->InStart) );
}
}
Handle = Handle->Next;