int Thread_Per_Connection_Logging_Server::handle_data(ACE_SOCK_Stream *client) { ACE_FILE_IO log_file; make_log_file(log_file, client); client->disable(ACE_NONBLOCK); Logging_Handler logging_handler(log_file, *client); ACE_Thread_Manager *tm = ACE_Thread_Manager::instance(); ACE_thread_t me = ACE_OS::thr_self(); while (!tm->testcancel(me) && logging_handler.log_record() != -1) continue; log_file.close(); return 0; }
int Thread_Per_Connection_Logging_Server::handle_data (ACE_SOCK_Stream *client) { ACE_FILE_IO log_file; // Client's hostname is logfile name. make_log_file (log_file, client); // Place the connection into blocking mode since this // thread isn't doing anything except handling this client. client->disable (ACE_NONBLOCK); Logging_Handler logging_handler (log_file, *client); // Keep handling log records until client closes connection // or this thread is asked to cancel itself. ACE_Thread_Manager *mgr = ACE_Thread_Manager::instance (); ACE_thread_t me = ACE_Thread::self (); while (!mgr->testcancel (me) && logging_handler.log_record () != -1) continue; log_file.close (); return 0; }