int ACE_SSL_SOCK_Acceptor::accept (ACE_SSL_SOCK_Stream &new_stream, ACE_Accept_QoS_Params qos_params, ACE_Addr *remote_addr, ACE_Time_Value *timeout, int restart, int reset_new_handle) const { ACE_TRACE ("ACE_SSL_SOCK_Acceptor::accept"); int in_blocking_mode = 0; if (this->shared_accept_start (timeout, restart, in_blocking_mode) == -1) return -1; else { // On Win32 the third parameter to <accept> must be a NULL // pointer if we want to ignore the client's address. int *len_ptr = 0; sockaddr *addr = 0; int len = 0; if (remote_addr != 0) { len = remote_addr->get_size (); len_ptr = &len; addr = (sockaddr *) remote_addr->get_addr (); } ACE_HANDLE handle; do handle = ACE_OS::accept (this->get_handle (), addr, len_ptr, qos_params); while (handle == ACE_INVALID_HANDLE && restart != 0 && errno == EINTR && timeout == 0); // Reset the size of the addr, which is only necessary for UNIX // domain sockets. if (handle != ACE_INVALID_HANDLE && remote_addr != 0) remote_addr->set_size (len); new_stream.set_handle (handle); } if (this->shared_accept_finish (new_stream, in_blocking_mode, reset_new_handle) != 0) return -1; if (in_blocking_mode) return this->ssl_accept (new_stream); return this->ssl_accept (new_stream, timeout); }
int ACE_SSL_SOCK_Acceptor::accept (ACE_SSL_SOCK_Stream &new_stream, ACE_Accept_QoS_Params qos_params, ACE_Addr *remote_addr, ACE_Time_Value *timeout, int restart, int reset_new_handle) const { ACE_TRACE ("ACE_SSL_SOCK_Acceptor::accept"); // Take into account the time to complete the basic TCP handshake // and the SSL handshake. ACE_Countdown_Time countdown (timeout); ACE_SOCK_Stream temp_stream; if (-1 == this->acceptor_.accept (temp_stream, qos_params, remote_addr, timeout, restart, reset_new_handle)) return -1; (void) countdown.update (); new_stream.set_handle (temp_stream.get_handle ()); temp_stream.set_handle (ACE_INVALID_HANDLE); if (this->ssl_accept (new_stream, timeout) == -1) { new_stream.close (); new_stream.set_handle (ACE_INVALID_HANDLE); return -1; } return 0; }