16 #include "connectionListener.h" 17 #include "connection.h" 18 #include "connectionManager.h" 19 #include "netAddress.h" 20 #include "config_net.h" 21 #include "socket_tcp_listen.h" 24 listener_thread_name(
const string &thread_name) {
25 if (!thread_name.empty()) {
28 return "ListenerThread";
38 const string &thread_name) :
50 void ConnectionListener::
53 <<
"ConnectionListener::receive_datagram called.\n";
63 bool ConnectionListener::
64 process_incoming_data(SocketInfo *sinfo) {
66 DCAST_INTO_R(socket, sinfo->get_socket(),
false);
71 bool got_connection = socket->GetIncomingConnection(*session, addr);
72 #if defined(HAVE_THREADS) && defined(SIMPLE_THREADS) 73 while (!got_connection && socket->
GetLastError() == LOCAL_BLOCKING_ERROR) {
75 got_connection = socket->GetIncomingConnection(*session, addr);
77 #endif // SIMPLE_THREADS 79 if (!got_connection) {
81 <<
"Error when accepting new connection.\n";
89 <<
"Received TCP connection from client " << net_addr.get_ip_string()
90 <<
" on port " << sinfo->_connection->get_address().get_port()
95 _manager->new_connection(new_connection);
97 connection_opened(sinfo->_connection, net_addr, new_connection);
Base functionality for a TCP connected socket This class is pretty useless by itself but it does hide...
A specific kind of Datagram, especially for sending across or receiving from a network.
The primary interface to the low-level networking layer in this package.
static void force_yield()
Suspends the current thread for the rest of the current epoch.
Connection(ConnectionManager *manager, Socket_IP *socket)
Creates a connection.
This is an abstract base class for a family of classes that listen for activity on a socket and respo...
Base functionality for a TCP rendezvous socket.
A simple place to store and munipulate tcp and port address for communication layer.
static int GetLastError()
gets the last errcode from a socket operation
Represents a single TCP or UDP socket for input or output.
Represents a network address to which UDP packets may be sent or to which a TCP socket may be bound...