Important Update:
- SelectableCore: - Simplify Handle AutoManage logic - Bug fix: AutoManage fail to open (WaitingToOpen) if no data written
This commit is contained in:
@@ -1245,10 +1245,12 @@ bool CSelectableCore::Write( THandle * Handle )
|
|||||||
if ((Handle->State == csNone) || (Handle->State == csFailed) || (Handle->State == csClosed))
|
if ((Handle->State == csNone) || (Handle->State == csFailed) || (Handle->State == csClosed))
|
||||||
{
|
{
|
||||||
// May it be opened?
|
// May it be opened?
|
||||||
if (Handle && Handle->AutoManage)
|
if (!Handle->AutoManage)
|
||||||
{
|
{
|
||||||
// Check duration since last PortIn
|
// Must be opened manually
|
||||||
if (Timeout( Handle->ReopenStart, Handle->ReopenDelay ))
|
return false;
|
||||||
|
}
|
||||||
|
else if (Timeout( Handle->ReopenStart, Handle->ReopenDelay ))
|
||||||
{
|
{
|
||||||
// Complete opening process
|
// Complete opening process
|
||||||
if (Open( Handle ) == -1) {
|
if (Open( Handle ) == -1) {
|
||||||
@@ -1257,12 +1259,6 @@ bool CSelectableCore::Write( THandle * Handle )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// Must be opened manually
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Log Ready for Write Event
|
// Log Ready for Write Event
|
||||||
if (Log) Log->Message( LogLevel, dlHigh, "%s: Handle '%s' - Write Event", Name, Handle->Name );
|
if (Log) Log->Message( LogLevel, dlHigh, "%s: Handle '%s' - Write Event", Name, Handle->Name );
|
||||||
@@ -1497,10 +1493,7 @@ int CSelectableCore::InputHandle( THandle * Handle, const char * Data, int Len )
|
|||||||
if (Log) Log->Message( LogLevel, dlHigh, "%s: Handle '%s' - Input rejected, Handle not Open (not auto-managed)", Name, Handle->Name );
|
if (Log) Log->Message( LogLevel, dlHigh, "%s: Handle '%s' - Input rejected, Handle not Open (not auto-managed)", Name, Handle->Name );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else if (Timeout( Handle->ReopenStart, Handle->ReopenDelay ))
|
||||||
{
|
|
||||||
// Check duration since last PortIn
|
|
||||||
if (Timeout( Handle->ReopenStart, Handle->ReopenDelay ))
|
|
||||||
{
|
{
|
||||||
// Complete opening process
|
// Complete opening process
|
||||||
if (Open( Handle ) == -1) {
|
if (Open( Handle ) == -1) {
|
||||||
@@ -1525,7 +1518,6 @@ int CSelectableCore::InputHandle( THandle * Handle, const char * Data, int Len )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Check packet length
|
// Check packet length
|
||||||
if (Len == -1) {
|
if (Len == -1) {
|
||||||
@@ -1604,7 +1596,7 @@ bool CSelectableCore::Process()
|
|||||||
while (Handle)
|
while (Handle)
|
||||||
{
|
{
|
||||||
// Auto manage handles
|
// Auto manage handles
|
||||||
if (Handle->AutoManage && Handle->Persistent && ((Handle->State == csNone) || (Handle->State == csFailed) || (Handle->State == csClosed)))
|
if ((Handle->State != csOpen) && Handle->AutoManage && Handle->Persistent)
|
||||||
{
|
{
|
||||||
// Check duration since last PortIn
|
// Check duration since last PortIn
|
||||||
if (Timeout( Handle->ReopenStart, Handle->ReopenDelay ))
|
if (Timeout( Handle->ReopenStart, Handle->ReopenDelay ))
|
||||||
|
|||||||
Reference in New Issue
Block a user