File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ class WorkQueue
91
91
bool Enqueue (WorkItem* item)
92
92
{
93
93
LOCK (cs);
94
- if (queue.size () >= maxDepth) {
94
+ if (!running || queue.size () >= maxDepth) {
95
95
return false ;
96
96
}
97
97
queue.emplace_back (std::unique_ptr<WorkItem>(item));
@@ -107,7 +107,7 @@ class WorkQueue
107
107
WAIT_LOCK (cs, lock);
108
108
while (running && queue.empty ())
109
109
cond.wait (lock);
110
- if (!running)
110
+ if (!running && queue. empty () )
111
111
break ;
112
112
i = std::move (queue.front ());
113
113
queue.pop_front ();
@@ -456,8 +456,6 @@ void StopHTTPServer()
456
456
thread.join ();
457
457
}
458
458
g_thread_http_workers.clear ();
459
- delete workQueue;
460
- workQueue = nullptr ;
461
459
}
462
460
// Unlisten sockets, these are what make the event loop running, which means
463
461
// that after this and all connections are closed the event loop will quit.
@@ -477,6 +475,10 @@ void StopHTTPServer()
477
475
event_base_free (eventBase);
478
476
eventBase = nullptr ;
479
477
}
478
+ if (workQueue) {
479
+ delete workQueue;
480
+ workQueue = nullptr ;
481
+ }
480
482
LogPrint (BCLog::HTTP, " Stopped HTTP server\n " );
481
483
}
482
484
You can’t perform that action at this time.
0 commit comments