#include <netcomm/utils/acceptor_thread.h>
Inheritance diagram for fawkes::NetworkAcceptorThread:
Public Member Functions | |
NetworkAcceptorThread (NetworkIncomingConnectionHandler *handler, unsigned short int port, const char *thread_name="NetworkAcceptorThread") | |
Constructor. | |
NetworkAcceptorThread (NetworkIncomingConnectionHandler *handler, StreamSocket *socket, const char *thread_name="NetworkAcceptorThread") | |
Constructor. | |
~NetworkAcceptorThread () | |
Destructor. | |
virtual void | loop () |
Thread loop. | |
Protected Member Functions | |
virtual void | run () |
Stub to see name in backtrace for easier debugging. |
Opens and maintains a server socket and waits for incoming connections. If that happens NetworkConnectionHandler::add_connection() is called.
Definition at line 34 of file acceptor_thread.h.
fawkes::NetworkAcceptorThread::NetworkAcceptorThread | ( | NetworkIncomingConnectionHandler * | handler, | |
unsigned short int | port, | |||
const char * | thread_name = "NetworkAcceptorThread" | |||
) |
Constructor.
handler | Connection handler for newly accepted incoming connections. | |
port | port to listen on for incoming connections | |
thread_name | name of the thread |
SocketException | as thrown by StreamSocket connstructor, bind and listen. |
Definition at line 45 of file acceptor_thread.cpp.
References fawkes::Socket::bind(), fawkes::Socket::listen(), and fawkes::Thread::set_prepfin_conc_loop().
fawkes::NetworkAcceptorThread::NetworkAcceptorThread | ( | NetworkIncomingConnectionHandler * | handler, | |
StreamSocket * | socket, | |||
const char * | thread_name = "NetworkAcceptorThread" | |||
) |
Constructor.
handler | Connection handler for newly accepted incoming connections. | |
socket | socket, must already be bound to the desired port. Socket::listen() will be called by the acceptor thread. | |
thread_name | name of the thread |
SocketException | as thrown by StreamSocket connstructor, bind and listen. |
Definition at line 72 of file acceptor_thread.cpp.
References fawkes::Socket::listen(), and fawkes::Thread::set_prepfin_conc_loop().
fawkes::NetworkAcceptorThread::~NetworkAcceptorThread | ( | ) |
void fawkes::NetworkAcceptorThread::loop | ( | ) | [virtual] |
Thread loop.
Waits on a socket for an incoming connection (blocking accept). If a new connection has been established it is reported to the handler.
Reimplemented from fawkes::Thread.
Definition at line 103 of file acceptor_thread.cpp.
References fawkes::Socket::accept(), and fawkes::NetworkIncomingConnectionHandler::add_connection().
virtual void fawkes::NetworkAcceptorThread::run | ( | ) | [inline, protected, virtual] |
Stub to see name in backtrace for easier debugging.
Reimplemented from fawkes::Thread.
Definition at line 48 of file acceptor_thread.h.
References fawkes::Thread::run().