17 #ifndef PAGESPEED_KERNEL_BASE_TCP_SERVER_THREAD_FOR_TESTING_H_
18 #define PAGESPEED_KERNEL_BASE_TCP_SERVER_THREAD_FOR_TESTING_H_
20 #include "apr_pools.h"
21 #include "apr_network_io.h"
26 #include "pagespeed/kernel/base/thread_annotations.h"
29 namespace net_instaweb {
66 apr_pool_t* pool() {
return pool_; }
72 virtual void HandleClientConnection(apr_socket_t* sock) = 0;
76 apr_socket_t* CreateAndBindSocket() EXCLUSIVE_LOCKS_REQUIRED(mutex_);
79 static void CreateAndBindSocket(apr_pool_t* apr_pool, apr_socket_t** socket,
88 const apr_port_t requested_listen_port_;
89 apr_port_t actual_listening_port_ GUARDED_BY(mutex_);
90 apr_socket_t* listen_sock_ GUARDED_BY(mutex_);
91 bool terminating_ GUARDED_BY(mutex_);
TcpServerThreadForTesting(apr_port_t listen_port, StringPiece thread_name, ThreadSystem *thread_system)
static void PickListenPortOnce(apr_port_t *port_number)
Definition: scoped_ptr.h:30
Definition: tcp_server_thread_for_testing.h:38
Definition: thread_system.h:40
apr_port_t GetListeningPort()
Base class for client thread code.
Definition: thread.h:34