1
0

cNetwork: Changed listening API.

The link-callbacks for each new accepted link are now received from the OnIncomingConnection listen-callback.
This commit is contained in:
Mattes D
2015-01-21 21:12:11 +01:00
parent 64855ed340
commit 5b4c5cf2be
5 changed files with 79 additions and 51 deletions

View File

@@ -46,8 +46,7 @@ public:
Always returns a server instance; in the event of a failure, the instance holds the error details. Use IsListening() to query success. */
static cServerHandleImplPtr Listen(
UInt16 a_Port,
cNetwork::cListenCallbacksPtr a_ListenCallbacks,
cTCPLink::cCallbacksPtr a_LinkCallbacks
cNetwork::cListenCallbacksPtr a_ListenCallbacks
);
// cServerHandle overrides:
@@ -58,9 +57,6 @@ protected:
/** The callbacks used to notify about incoming connections. */
cNetwork::cListenCallbacksPtr m_ListenCallbacks;
/** The callbacks used to create new cTCPLink instances for incoming connections. */
cTCPLink::cCallbacksPtr m_LinkCallbacks;
/** The LibEvent handle representing the main listening socket. */
evconnlistener * m_ConnListener;
@@ -86,10 +82,7 @@ protected:
/** Creates a new instance with the specified callbacks.
Initializes the internals, but doesn't start listening yet. */
cServerHandleImpl(
cNetwork::cListenCallbacksPtr a_ListenCallbacks,
cTCPLink::cCallbacksPtr a_LinkCallbacks
);
cServerHandleImpl(cNetwork::cListenCallbacksPtr a_ListenCallbacks);
/** Starts listening on the specified port.
Returns true if successful, false on failure. On failure, sets m_ErrorCode and m_ErrorMsg. */