|
CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
|
Bookkeeping for one worker thread of a NetworkChannel (per listener or connection). More...
#include <NetworkManager.h>
Public Member Functions | |
| NetworkThread (NetworkChannel *parent, uint64 id) | |
| ~NetworkThread () | |
Public Attributes | |
| uint64 | id |
| Connection or listener id served by this thread. | |
| uint32 | threadID |
| ThreadManager id of the worker thread. | |
| ThreadHandle | hWorker |
| OS-level handle of the worker thread (0 until started). | |
| bool | reaping |
| Set by whichever teardown path has CLAIMED this object for freeing. | |
| uint16 | port |
| Local port (listeners) or 0. | |
| TCPListener * | listener |
| Listener served (owned), or NULL for connections. | |
| NetworkConnection * | con |
| Connection served (owned), or NULL for listeners. | |
| uint32 | defaultProtocol |
| Fallback PROTOCOL_* when auto-detection is inconclusive. | |
| uint32 | autoProtocols |
| PROTOCOL_* bit set to auto-detect among. | |
| uint32 | autoProtocolTimeout |
| Milliseconds allowed for protocol sniffing. | |
| bool | autoreconnect |
| Re-establish the connection automatically on failure. | |
| bool | shouldContinue |
| Loop control flag: thread exits when false. | |
| bool | isRunning |
| True while the worker loop is active. | |
| bool | isAsync |
| Push to receiver (true) or queue for waitFor*() (false). | |
| HTTPRequest * | lastRequest |
| Last request pending a reply on this HTTP connection. | |
| NetworkChannel * | parent |
| Owning channel (not owned). | |
Bookkeeping for one worker thread of a NetworkChannel (per listener or connection).
Plain data holder tying together the thread, its socket object (listener or connection), protocol settings and lifecycle flags. Created and owned by NetworkChannel; not for direct external use.
Definition at line 431 of file NetworkManager.h.
| cmlabs::NetworkThread::NetworkThread | ( | NetworkChannel * | parent, |
| uint64 | id ) |
| parent | Owning channel. |
| id | Connection/listener id this thread serves. |
Definition at line 28 of file NetworkManager.cpp.
References autoProtocols, autoProtocolTimeout, autoreconnect, con, defaultProtocol, hWorker, isAsync, isRunning, lastRequest, listener, parent, port, reaping, and shouldContinue.
| cmlabs::NetworkThread::~NetworkThread | ( | ) |
Definition at line 48 of file NetworkManager.cpp.
References autoreconnect, con, isRunning, lastRequest, listener, and shouldContinue.
| uint32 cmlabs::NetworkThread::autoProtocols |
PROTOCOL_* bit set to auto-detect among.
Definition at line 449 of file NetworkManager.h.
Referenced by cmlabs::NetworkChannel::autoDetectConnection(), cmlabs::NetworkChannel::ConnectionAutodetectRun(), cmlabs::NetworkChannel::NetworkListenerRun(), NetworkThread(), cmlabs::NetworkChannel::startListener(), and cmlabs::NetworkChannel::stopListener().
| uint32 cmlabs::NetworkThread::autoProtocolTimeout |
Milliseconds allowed for protocol sniffing.
Definition at line 450 of file NetworkManager.h.
Referenced by cmlabs::NetworkChannel::autoDetectConnection(), cmlabs::NetworkChannel::ConnectionAutodetectRun(), cmlabs::NetworkChannel::NetworkListenerRun(), NetworkThread(), and cmlabs::NetworkChannel::startListener().
| bool cmlabs::NetworkThread::autoreconnect |
Re-establish the connection automatically on failure.
Definition at line 451 of file NetworkManager.h.
Referenced by cmlabs::NetworkChannel::autoDetectConnection(), cmlabs::NetworkChannel::endConnection(), cmlabs::NetworkChannel::HTTPClientRun(), cmlabs::NetworkChannel::MessageConnectionRun(), NetworkThread(), cmlabs::NetworkChannel::shutdown(), cmlabs::NetworkChannel::startConnection(), and ~NetworkThread().
| NetworkConnection* cmlabs::NetworkThread::con |
Connection served (owned), or NULL for listeners.
Definition at line 447 of file NetworkManager.h.
Referenced by cmlabs::NetworkChannel::autoDetectConnection(), cmlabs::NetworkChannel::ConnectionAutodetectRun(), cmlabs::NetworkChannel::getConnectionType(), cmlabs::NetworkChannel::getInputSpeed(), cmlabs::NetworkChannel::getOutputSpeed(), cmlabs::NetworkChannel::getRemoteAddress(), cmlabs::NetworkChannel::HTTPClientRun(), cmlabs::NetworkChannel::HTTPServerRun(), cmlabs::NetworkChannel::isConnected(), cmlabs::NetworkChannel::MessageConnectionRun(), NetworkThread(), cmlabs::NetworkChannel::sendHTTPReply(), cmlabs::NetworkChannel::sendHTTPRequest(), cmlabs::NetworkChannel::sendMessage(), cmlabs::NetworkChannel::sendReceiveHTTPRequest(), cmlabs::NetworkChannel::sendReceiveTelnetLine(), cmlabs::NetworkChannel::sendTelnetLine(), cmlabs::NetworkChannel::sendWebsocketData(), cmlabs::NetworkChannel::startConnection(), cmlabs::NetworkChannel::TelnetServerRun(), and ~NetworkThread().
| uint32 cmlabs::NetworkThread::defaultProtocol |
Fallback PROTOCOL_* when auto-detection is inconclusive.
Definition at line 448 of file NetworkManager.h.
Referenced by cmlabs::NetworkChannel::autoDetectConnection(), cmlabs::NetworkChannel::ConnectionAutodetectRun(), cmlabs::NetworkChannel::HTTPClientRun(), cmlabs::NetworkChannel::HTTPServerRun(), cmlabs::NetworkChannel::MessageConnectionRun(), cmlabs::NetworkChannel::NetworkListenerRun(), NetworkThread(), cmlabs::NetworkChannel::startConnection(), cmlabs::NetworkChannel::startListener(), cmlabs::NetworkChannel::stopListener(), and cmlabs::NetworkChannel::TelnetServerRun().
| ThreadHandle cmlabs::NetworkThread::hWorker |
OS-level handle of the worker thread (0 until started).
Definition at line 439 of file NetworkManager.h.
Referenced by cmlabs::NetworkChannel::autoDetectConnection(), NetworkThread(), cmlabs::NetworkChannel::startConnection(), and cmlabs::NetworkChannel::startListener().
| uint64 cmlabs::NetworkThread::id |
Connection or listener id served by this thread.
Definition at line 437 of file NetworkManager.h.
Referenced by cmlabs::NetworkChannel::ConnectionAutodetectRun(), cmlabs::NetworkChannel::endUDPConnection(), cmlabs::NetworkChannel::HTTPClientRun(), cmlabs::NetworkChannel::HTTPServerRun(), cmlabs::NetworkChannel::MessageConnectionRun(), and cmlabs::NetworkChannel::TelnetServerRun().
| bool cmlabs::NetworkThread::isAsync |
Push to receiver (true) or queue for waitFor*() (false).
Definition at line 454 of file NetworkManager.h.
Referenced by cmlabs::NetworkChannel::autoDetectConnection(), cmlabs::NetworkChannel::NetworkListenerRun(), NetworkThread(), cmlabs::NetworkChannel::sendReceiveTelnetLine(), cmlabs::NetworkChannel::startConnection(), cmlabs::NetworkChannel::startListener(), and cmlabs::NetworkChannel::TelnetServerRun().
| bool cmlabs::NetworkThread::isRunning |
True while the worker loop is active.
Definition at line 453 of file NetworkManager.h.
Referenced by cmlabs::NetworkChannel::ConnectionAutodetectRun(), cmlabs::NetworkChannel::endConnection(), cmlabs::NetworkChannel::HTTPClientRun(), cmlabs::NetworkChannel::HTTPServerRun(), cmlabs::NetworkChannel::MessageConnectionRun(), cmlabs::NetworkChannel::NetworkListenerRun(), NetworkThread(), cmlabs::NetworkChannel::shutdown(), cmlabs::NetworkChannel::stopListener(), cmlabs::NetworkChannel::TelnetServerRun(), and ~NetworkThread().
| HTTPRequest* cmlabs::NetworkThread::lastRequest |
Last request pending a reply on this HTTP connection.
Definition at line 455 of file NetworkManager.h.
Referenced by NetworkThread(), and ~NetworkThread().
| TCPListener* cmlabs::NetworkThread::listener |
Listener served (owned), or NULL for connections.
Definition at line 446 of file NetworkManager.h.
Referenced by cmlabs::NetworkChannel::NetworkListenerRun(), NetworkThread(), cmlabs::NetworkChannel::startListener(), and ~NetworkThread().
| NetworkChannel* cmlabs::NetworkThread::parent |
Owning channel (not owned).
Definition at line 456 of file NetworkManager.h.
Referenced by cmlabs::NetworkChannel::autoDetectConnection(), cmlabs::NetworkChannel::ConnectionAutodetectRun(), cmlabs::NetworkChannel::HTTPClientRun(), cmlabs::NetworkChannel::HTTPServerRun(), cmlabs::NetworkChannel::MessageConnectionRun(), cmlabs::NetworkChannel::NetworkListenerRun(), NetworkThread(), and cmlabs::NetworkChannel::TelnetServerRun().
| uint16 cmlabs::NetworkThread::port |
Local port (listeners) or 0.
Definition at line 445 of file NetworkManager.h.
Referenced by cmlabs::NetworkChannel::NetworkListenerRun(), NetworkThread(), and cmlabs::NetworkChannel::startListener().
| bool cmlabs::NetworkThread::reaping |
Set by whichever teardown path has CLAIMED this object for freeing.
Map-absence is NOT proof of exclusive ownership: shutdown() snapshots thread pointers under channelMutex and frees them after releasing it, so a pointer can outlive its map entry. This flag closes that double-delete window.
Definition at line 440 of file NetworkManager.h.
Referenced by cmlabs::NetworkChannel::endConnection(), NetworkThread(), cmlabs::NetworkChannel::shutdown(), and cmlabs::NetworkChannel::stopListener().
| bool cmlabs::NetworkThread::shouldContinue |
Loop control flag: thread exits when false.
Definition at line 452 of file NetworkManager.h.
Referenced by cmlabs::NetworkChannel::ConnectionAutodetectRun(), cmlabs::NetworkChannel::endConnection(), cmlabs::NetworkChannel::HTTPClientRun(), cmlabs::NetworkChannel::HTTPServerRun(), cmlabs::NetworkChannel::MessageConnectionRun(), cmlabs::NetworkChannel::NetworkListenerRun(), NetworkThread(), cmlabs::NetworkChannel::shutdown(), cmlabs::NetworkChannel::stopListener(), cmlabs::NetworkChannel::TelnetServerRun(), and ~NetworkThread().
| uint32 cmlabs::NetworkThread::threadID |
ThreadManager id of the worker thread.
Definition at line 438 of file NetworkManager.h.
Referenced by cmlabs::NetworkChannel::autoDetectConnection(), cmlabs::NetworkChannel::endConnection(), cmlabs::NetworkChannel::shutdown(), cmlabs::NetworkChannel::startConnection(), cmlabs::NetworkChannel::startListener(), and cmlabs::NetworkChannel::stopListener().