summaryrefslogtreecommitdiffstats
path: root/src/OSSupport/TCPLinkImpl.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-01-22 13:00:32 +0100
committerMattes D <github@xoft.cz>2015-01-22 20:13:06 +0100
commitdbf7f13bd414daea5e787da2543df186dc465c34 (patch)
treec6ca36fcd22b422b89222a8c29beb046e70b4de6 /src/OSSupport/TCPLinkImpl.h
parentcNetwork: Changed listening API. (diff)
downloadcuberite-dbf7f13bd414daea5e787da2543df186dc465c34.tar
cuberite-dbf7f13bd414daea5e787da2543df186dc465c34.tar.gz
cuberite-dbf7f13bd414daea5e787da2543df186dc465c34.tar.bz2
cuberite-dbf7f13bd414daea5e787da2543df186dc465c34.tar.lz
cuberite-dbf7f13bd414daea5e787da2543df186dc465c34.tar.xz
cuberite-dbf7f13bd414daea5e787da2543df186dc465c34.tar.zst
cuberite-dbf7f13bd414daea5e787da2543df186dc465c34.zip
Diffstat (limited to '')
-rw-r--r--src/OSSupport/TCPLinkImpl.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/OSSupport/TCPLinkImpl.h b/src/OSSupport/TCPLinkImpl.h
index edd295fe2..66347afe0 100644
--- a/src/OSSupport/TCPLinkImpl.h
+++ b/src/OSSupport/TCPLinkImpl.h
@@ -37,7 +37,8 @@ class cTCPLinkImpl:
public:
/** Creates a new link based on the given socket.
Used for connections accepted in a server using cNetwork::Listen().
- a_Address and a_AddrLen describe the remote peer that has connected. */
+ a_Address and a_AddrLen describe the remote peer that has connected.
+ The link is created disabled, you need to call Enable() to start the regular communication. */
cTCPLinkImpl(evutil_socket_t a_Socket, cCallbacksPtr a_LinkCallbacks, cServerHandleImpl * a_Server, const sockaddr * a_Address, socklen_t a_AddrLen);
/** Destroys the LibEvent handle representing the link. */
@@ -48,6 +49,11 @@ public:
Returns a link that has the connection request queued, or NULL for failure. */
static cTCPLinkImplPtr Connect(const AString & a_Host, UInt16 a_Port, cTCPLink::cCallbacksPtr a_LinkCallbacks, cNetwork::cConnectCallbacksPtr a_ConnectCallbacks);
+ /** Enables communication over the link.
+ Links are created with communication disabled, so that creation callbacks can be called first.
+ This function then enables the regular communication to be reported. */
+ void Enable(void);
+
// cTCPLink overrides:
virtual bool Send(const void * a_Data, size_t a_Length) override;
virtual AString GetLocalIP(void) const override { return m_LocalIP; }
@@ -85,7 +91,8 @@ protected:
/** Creates a new link to be queued to connect to a specified host:port.
Used for outgoing connections created using cNetwork::Connect().
- To be used only by the Connect() factory function. */
+ To be used only by the Connect() factory function.
+ The link is created disabled, you need to call Enable() to start the regular communication. */
cTCPLinkImpl(const cCallbacksPtr a_LinkCallbacks);
/** Callback that LibEvent calls when there's data available from the remote peer. */