Important update:
- Detect serial port disconnect/close
This commit is contained in:
@@ -1130,12 +1130,30 @@ bool CSelectableCore::Read( THandle * Handle )
|
||||
ioctl( Handle->FD, FIONREAD, &BytesWaiting );
|
||||
|
||||
// EOF from server
|
||||
if (!BytesWaiting)
|
||||
if (BytesWaiting < 1)
|
||||
{
|
||||
// Close Handle
|
||||
Close( Handle );
|
||||
|
||||
// Destroy Remote Client
|
||||
// Destroy Client
|
||||
if (Handle->Type == ctRemoteClient) {
|
||||
RemoveHandle( Handle );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (Handle->Type == ctPort)
|
||||
{
|
||||
// Check if anything to read
|
||||
ioctl( Handle->FD, FIONREAD, &BytesWaiting );
|
||||
|
||||
// EOF from port
|
||||
if (BytesWaiting < 1)
|
||||
{
|
||||
// Close Handle
|
||||
Close( Handle );
|
||||
|
||||
// Destroy Port
|
||||
if (Handle->Type == ctRemoteClient) {
|
||||
RemoveHandle( Handle );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user