Important Update:

- SelectableCore:
  - Made GetType() & GetState() public methods
  - Update logs in Input()
- FunctionCore:
  - Add Input/OutputEnabled parameters with Get/Set methods.
  - Update logging in Input() and Output()
  - Check if input/output enabled in Input() and Output()
This commit is contained in:
Charl Wentzel
2017-07-05 10:59:24 +02:00
parent c50d920f94
commit 748b62d235
4 changed files with 88 additions and 48 deletions

View File

@@ -1146,21 +1146,20 @@ int CSelectableCore::Input( const char * ChannelName, const char * Data, int Len
if (!ChannelName || !Data) {
return 0;
}
else if (Len == -1) {
Len = strlen( Data );
}
// Get File handle
if (!(Handle = GetHandle( ChannelName )))
{
// Log event
if (Log) Log->Message( DebugLevel, dlHigh, "%s: Channel '%s' - Input rejected, Input not found", Name, ChannelName );
if (!(Handle = GetHandle( ChannelName ))) {
// Handle not found
if (Log) Log->Message( DebugLevel, dlHigh, "%s: Channel '%s' - Input rejected, Handle not found", Name, ChannelName );
return 0;
}
// Check that handle is open
else if (Handle->State != csOpen)
{
// Log event
else if (Handle->Channel && !Handle->Channel->InputEnabled) {
// Handle is not open
if (Log) Log->Message( DebugLevel, dlHigh, "%s: Channel '%s' - Input rejected, Channel input disabled", Name, ChannelName );
return 0;
}
else if (Handle->State != csOpen) {
// Handle is not open
if (Log) Log->Message( DebugLevel, dlHigh, "%s: Channel '%s' - Input rejected, Handle not Open", Name, ChannelName );
return 0;
}
@@ -1168,6 +1167,11 @@ int CSelectableCore::Input( const char * ChannelName, const char * Data, int Len
// Log event
if (Log) Log->Output( DebugLevel, dlHigh, OutputDisplay, Data, Len, "%s: Channel '%s' - IN:", Name, ChannelName );
// Check packet length
if (Len == -1) {
Len = strlen( Data );
}
if (Handle->Type == ctServer)
{
// Cannot write to server socket, so Update Remote Client connections individually