| 432 | |
| 433 | |
| 434 | inline void tcp_accept(SOCKET_T& sockfd, SOCKET_T& clientfd, func_args& args) |
| 435 | { |
| 436 | tcp_listen(sockfd); |
| 437 | |
| 438 | SOCKADDR_IN_T client; |
| 439 | socklen_t client_len = sizeof(client); |
| 440 | |
| 441 | #if defined(_POSIX_THREADS) && defined(NO_MAIN_DRIVER) |
| 442 | // signal ready to tcp_accept |
| 443 | tcp_ready& ready = *args.signal_; |
| 444 | pthread_mutex_lock(&ready.mutex_); |
| 445 | ready.ready_ = true; |
| 446 | pthread_cond_signal(&ready.cond_); |
| 447 | pthread_mutex_unlock(&ready.mutex_); |
| 448 | #endif |
| 449 | |
| 450 | if (args.file_ready) |
| 451 | create_ready_file(args); |
| 452 | |
| 453 | clientfd = accept(sockfd, (sockaddr*)&client, (ACCEPT_THIRD_T)&client_len); |
| 454 | |
| 455 | if (clientfd == (SOCKET_T) -1) { |
| 456 | tcp_close(sockfd); |
| 457 | err_sys("tcp accept failed"); |
| 458 | } |
| 459 | |
| 460 | #ifdef NON_BLOCKING |
| 461 | tcp_set_nonblocking(clientfd); |
| 462 | #endif |
| 463 | } |
| 464 | |
| 465 | |
| 466 | inline void showPeer(SSL* ssl) |
no test coverage detected