20#include "socket_tcp_listen.h"
23listener_thread_name(
const std::string &thread_name) {
24 if (!thread_name.empty()) {
27 return "ListenerThread";
35 const std::string &thread_name) :
44void ConnectionListener::
47 <<
"ConnectionListener::receive_datagram called.\n";
54bool ConnectionListener::
55process_incoming_data(SocketInfo *sinfo) {
56 Socket_TCP_Listen *socket;
57 DCAST_INTO_R(socket, sinfo->get_socket(),
false);
60 Socket_TCP *session =
new Socket_TCP;
62 bool got_connection = socket->GetIncomingConnection(*session, addr);
63#if defined(HAVE_THREADS) && defined(SIMPLE_THREADS)
64 while (!got_connection && socket->
GetLastError() == LOCAL_BLOCKING_ERROR) {
66 got_connection = socket->GetIncomingConnection(*session, addr);
70 if (!got_connection) {
72 <<
"Error when accepting new connection.\n";
78 NetAddress net_addr(addr);
80 <<
"Received TCP connection from client " << net_addr
81 <<
" on port " << sinfo->_connection->get_address().get_port()
84 PT(Connection) new_connection =
new Connection(_manager, session);
85 if (_manager !=
nullptr) {
86 _manager->new_connection(new_connection);
88 connection_opened(sinfo->_connection, net_addr, new_connection);
The primary interface to the low-level networking layer in this package.
This is an abstract base class for a family of classes that listen for activity on a socket and respo...
A specific kind of Datagram, especially for sending across or receiving from a network.
static int GetLastError()
Gets the last errcode from a socket operation.
static void force_yield()
Suspends the current thread for the rest of the current epoch.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.