MCPcopy Create free account
hub / github.com/davisking/dlib / service_connection

Method service_connection

dlib/server/server_kernel.cpp:556–588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

554 const logger server::sdlog("dlib.server");
555
556 void server::
557 service_connection(
558 void* item
559 )
560 {
561 param& p = *static_cast<param*>(item);
562
563
564 p.the_server.on_connect(p.new_connection);
565
566
567 // remove this connection from cons and close it
568 p.the_server.cons_mutex.lock();
569 connection* temp;
570 if (p.the_server.cons.is_member(&p.new_connection))
571 p.the_server.cons.remove(&p.new_connection,temp);
572 p.the_server.cons_mutex.unlock();
573
574 try{ close_gracefully(&p.new_connection, p.graceful_close_timeout); }
575 catch (...) { sdlog << LERROR << "close_gracefully() threw"; }
576
577 // decrement the thread count and signal if it is now zero
578 p.the_server.thread_count_mutex.lock();
579 --p.the_server.thread_count;
580 p.the_server.thread_count_signaler.broadcast();
581 if (p.the_server.thread_count == 0)
582 p.the_server.thread_count_zero.broadcast();
583 p.the_server.thread_count_mutex.unlock();
584
585 delete &p;
586
587
588 }
589
590// ----------------------------------------------------------------------------------------
591

Callers

nothing calls this directly

Calls 6

close_gracefullyFunction · 0.85
removeMethod · 0.80
on_connectMethod · 0.45
lockMethod · 0.45
unlockMethod · 0.45
broadcastMethod · 0.45

Tested by

no test coverage detected