Important Update:

- SelectCore:
  - Bug fix: only remove handle from read/write list if different function
This commit is contained in:
Charl Wentzel
2017-12-06 09:56:28 +02:00
parent 7f39f8b985
commit 7c33c9dbc7

View File

@@ -93,19 +93,22 @@ void CSelect::Add( int FD, bool Read, bool Write, CSelectableCore * Function )
while (*Handle && ((*Handle)->FD != FD)) {
Handle = &((*Handle)->Next);
}
if (*Handle) {
// Old handle not yet removed, remove from read/write lists
Remove( FD, true, true );
}
else {
if (!*Handle) {
// Create if not exist
*Handle = (TSelectHandle*)malloc( sizeof(TSelectHandle) );
memset( *Handle, 0, sizeof(TSelectHandle) );
(*Handle)->FD = FD;
}
// Set Parameters
(*Handle)->FD = FD;
(*Handle)->Function = Function;
}
else if ((*Handle)->Function != Function) {
// Old handle for another function, not yet removed, remove from read/write lists
Remove( FD, true, true );
// Overwrite Parameters
(*Handle)->Function = Function;
}
// Add Read select
if (Read && !(*Handle)->Read) {