File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -234,7 +234,16 @@ Server::~Server() {
234234 socketFD_ = -1 ;
235235 }
236236 for (auto &future : workerFutures_) {
237- future.Get ();
237+ try {
238+ if (future.valid ()) {
239+ future.Get ();
240+ }
241+ } catch (const std::exception &error) {
242+ std::cerr << " [Server] Worker shutdown failed: " << error.what ()
243+ << std::endl;
244+ } catch (...) {
245+ std::cerr << " [Server] Worker shutdown failed" << std::endl;
246+ }
238247 }
239248}
240249
@@ -265,6 +274,14 @@ void Server::WorkerLoop(IOUring &ring) {
265274 acceptCoro = AcceptAndProcess (ring);
266275 }
267276 }
277+
278+ for (int attempts = 0 ; !acceptCoro.isReady () && attempts < 1000 ;
279+ ++attempts) {
280+ ring.Poll ();
281+ }
282+ if (acceptCoro.isReady ()) {
283+ acceptCoro.Get ();
284+ }
268285 } catch (const std::exception &e) {
269286 std::cerr << " [WorkerLoop] Exception: " << e.what () << std::endl;
270287 } catch (...) {
You can’t perform that action at this time.
0 commit comments