Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fix #386 stuck on exit because of stucked wait in netloop
- Loading branch information
Showing
with
20 additions
and
0 deletions.
-
+19
−0
src/searchdha.cpp
-
+1
−0
src/searchdha.h
|
@@ -1762,6 +1762,11 @@ void AgentConn_t::HardTimeoutCallback () |
|
|
sphLogDebugA ( "%d <- hard timeout (ref=%d)", m_iStoreTag, ( int ) GetRefcount () ); |
|
|
} |
|
|
|
|
|
void AgentConn_t::AbortCallback() |
|
|
{ |
|
|
ReportFinish (false); |
|
|
} |
|
|
|
|
|
void AgentConn_t::ErrorCallback ( int64_t iWaited ) |
|
|
{ |
|
|
if ( !m_pPollerTask ) |
|
@@ -3540,6 +3545,19 @@ class LazyNetEvents_c : ISphNoncopyable, protected NetEventsFlavour_c |
|
|
return bHasTimeout; /// means 'infinite' |
|
|
} |
|
|
|
|
|
/// abandon and release all events (on shutdown) |
|
|
void AbortScheduled () |
|
|
{ |
|
|
while ( !m_dTimeouts.IsEmpty () ) |
|
|
{ |
|
|
auto pTask = m_dTimeouts.Root (); |
|
|
m_dTimeouts.Pop (); |
|
|
CSphRefcountedPtr<AgentConn_t> pKeepConn ( DeleteTask ( pTask, false ) ); |
|
|
if ( pKeepConn ) |
|
|
pKeepConn->AbortCallback (); |
|
|
} |
|
|
} |
|
|
|
|
|
/// one event cycle. |
|
|
/// \return false to stop event loop and exit. |
|
|
bool EventTick () REQUIRES ( LazyThread ) |
|
@@ -3558,6 +3576,7 @@ class LazyNetEvents_c : ISphNoncopyable, protected NetEventsFlavour_c |
|
|
|
|
|
if ( g_bShutdown ) |
|
|
{ |
|
|
AbortScheduled(); |
|
|
sphInfo ( "EventTick() exit because of shutdown=%d", g_bShutdown ); |
|
|
return false; |
|
|
} |
|
|
|
@@ -495,6 +495,7 @@ struct AgentConn_t : public ISphRefcountedMT |
|
|
void RecvCallback ( int64_t iWaited, DWORD uReceived ); |
|
|
void SoftTimeoutCallback(); |
|
|
void HardTimeoutCallback(); |
|
|
void AbortCallback(); |
|
|
|
|
|
#if USE_WINDOWS |
|
|
// move recv buffer to dOut, reinit mine. |
|
|