| 296 | } |
| 297 | |
| 298 | bool cbm_httpd_close(cbm_httpd_t *d) { |
| 299 | if (!d) |
| 300 | return true; |
| 301 | cbm_mutex_lock(&d->active_mutex); |
| 302 | d->interrupted = true; |
| 303 | if (d->active) { |
| 304 | socket_shutdown(d->active->fd); |
| 305 | cbm_mutex_unlock(&d->active_mutex); |
| 306 | return false; |
| 307 | } |
| 308 | cbm_mutex_unlock(&d->active_mutex); |
| 309 | cbm_sock_close(d->fd); |
| 310 | cbm_mutex_destroy(&d->active_mutex); |
| 311 | free(d); |
| 312 | return true; |
| 313 | } |
| 314 | |
| 315 | void cbm_httpd_set_send_deadline_for_test(cbm_httpd_t *d, int ms) { |
| 316 | /* Lets a test pin the send deadline far above (or below) the default so |
no test coverage detected