| 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 |
nothing calls this directly
no test coverage detected