MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / tcp_accept

Function tcp_accept

extra/yassl/testsuite/test.hpp:434–463  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

432
433
434inline 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
466inline void showPeer(SSL* ssl)

Callers 1

server_testFunction · 0.85

Calls 6

tcp_listenFunction · 0.85
pthread_cond_signalFunction · 0.85
create_ready_fileFunction · 0.85
tcp_closeFunction · 0.85
tcp_set_nonblockingFunction · 0.85
err_sysFunction · 0.70

Tested by

no test coverage detected