|
Adbase
Adinf C++ base library V2
|
#include <TcpServer.hpp>
Public Member Functions | |
| TcpServer (EventBasePtr &base, InetAddress &listenAddr, const std::string &name) | |
| ~TcpServer () | |
| void | threadFunc (int id) |
| void | start (int threadNum) |
| void | stop () |
| void | setConnectionCallback (const ConnectionCallback &cb) |
| void | setMessageCallback (const MessageCallback &cb) |
| void | setWriteCompleteCallback (const WriteCompleteCallback &cb) |
| void | setCloseCallback (const CloseCallback &cb) |
| void | newConnection (const InetAddress &remoteAddr, int connfd) |
Static Public Member Functions | |
| static void | deleteThread (std::thread *t) |
Definition at line 24 of file TcpServer.hpp.
| adbase::TcpServer::TcpServer | ( | EventBasePtr & | base, |
| InetAddress & | listenAddr, | ||
| const std::string & | name | ||
| ) |
Definition at line 8 of file TcpServer.cpp.
References newConnection(), and adbase::Acceptor::setNewConnection().
| adbase::TcpServer::~TcpServer | ( | ) |
Definition at line 104 of file TcpServer.cpp.
|
static |
Definition at line 95 of file TcpServer.cpp.
References LOG_ERROR.
Referenced by setCloseCallback(), and start().
| void adbase::TcpServer::newConnection | ( | const InetAddress & | remoteAddr, |
| int | connfd | ||
| ) |
Definition at line 74 of file TcpServer.cpp.
References adbase::ConnectionBaseInfo::connfd, adbase::ConnectionBaseInfo::localAddress, LOG_ERROR, adbase::ConnectionBaseInfo::peerAddress, and adbase::InetAddress::toPort().
Referenced by setCloseCallback(), and TcpServer().
|
inline |
Definition at line 40 of file TcpServer.hpp.
References deleteThread(), and newConnection().
|
inline |
Definition at line 31 of file TcpServer.hpp.
|
inline |
Definition at line 34 of file TcpServer.hpp.
|
inline |
Definition at line 37 of file TcpServer.hpp.
| void adbase::TcpServer::start | ( | int | threadNum | ) |
Definition at line 22 of file TcpServer.cpp.
References deleteThread(), adbase::Acceptor::init(), LOG_DEBUG, LOG_FATAL, and threadFunc().
| void adbase::TcpServer::stop | ( | ) |
Definition at line 47 of file TcpServer.cpp.
References LOG_ERROR.
| void adbase::TcpServer::threadFunc | ( | int | id | ) |
Definition at line 62 of file TcpServer.cpp.
References adbase::TcpWorker::setCloseCallback(), adbase::TcpWorker::setConnectionCallback(), adbase::TcpWorker::setMessageCallback(), adbase::TcpWorker::setWriteCompleteCallback(), and adbase::TcpWorker::start().
Referenced by start().