Skip to content
Permalink
Browse files

fixed #1020 wrong index after event removed at netloop at windows\pol…

…l poller
  • Loading branch information...
tomatolog committed Sep 3, 2019
1 parent 603631e commit 8ca78c138d837caab30dc6e2343a3c4d1687bb87
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/searchdha.cpp
@@ -4286,6 +4286,7 @@ class PollEvents_c : public ISphNetPoller, public TimeoutEvents_c
return;

m_dDefferedRemove.Uniq ();
// need to walk removal index list backward to remove items from m_dWork that just passed by
m_dDefferedRemove.RSort ();

for ( int iToRemove:m_dDefferedRemove )
@@ -4294,6 +4295,9 @@ class PollEvents_c : public ISphNetPoller, public TimeoutEvents_c
RemoveTimeout ( pEvent );
m_dEvents.RemoveFast ( iToRemove );
m_dWork.RemoveFast ( iToRemove );
// restore index
if ( iToRemove<m_dWork.GetLength() )
m_dWork[iToRemove]->m_tBack.iIdx = iToRemove;
}
m_dDefferedRemove.Resize (0);
}
@@ -4437,7 +4441,7 @@ class SelectEvents_c : public ISphNetPoller, public TimeoutEvents_c
int m_iMaxSocket = 0;
int m_iReady = 0;
int m_iLastReportedErrno = -1;
friend struct NetPollReadyIterator_c;
friend class NetPollReadyIterator_c;

void RemoveDeffered ()
{
@@ -4453,6 +4457,9 @@ class SelectEvents_c : public ISphNetPoller, public TimeoutEvents_c
RemoveTimeout ( pEvent );
m_dSockets.RemoveFast ( iToRemove );
m_dWork.RemoveFast ( iToRemove );
// restore index
if ( iToRemove<m_dWork.GetLength() )
m_dWork[iToRemove]->m_tBack.iIdx = iToRemove;
}
m_dDefferedRemove.Resize ( 0 );
}

0 comments on commit 8ca78c1

Please sign in to comment.
You can’t perform that action at this time.