summaryrefslogtreecommitdiffstats
path: root/src/OSSupport/Network.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-01-21 21:12:11 +0100
committerMattes D <github@xoft.cz>2015-01-22 20:13:05 +0100
commit5b4c5cf2befebb78ff2b16955c244e79841648a7 (patch)
treefd634bd69b029b1b4f4850dd48408997e5b6fbfa /src/OSSupport/Network.h
parentcNetwork: Added error message to error callbacks. (diff)
downloadcuberite-5b4c5cf2befebb78ff2b16955c244e79841648a7.tar
cuberite-5b4c5cf2befebb78ff2b16955c244e79841648a7.tar.gz
cuberite-5b4c5cf2befebb78ff2b16955c244e79841648a7.tar.bz2
cuberite-5b4c5cf2befebb78ff2b16955c244e79841648a7.tar.lz
cuberite-5b4c5cf2befebb78ff2b16955c244e79841648a7.tar.xz
cuberite-5b4c5cf2befebb78ff2b16955c244e79841648a7.tar.zst
cuberite-5b4c5cf2befebb78ff2b16955c244e79841648a7.zip
Diffstat (limited to '')
-rw-r--r--src/OSSupport/Network.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/OSSupport/Network.h b/src/OSSupport/Network.h
index 3ed9885ec..b9ca377cb 100644
--- a/src/OSSupport/Network.h
+++ b/src/OSSupport/Network.h
@@ -139,8 +139,15 @@ public:
// Force a virtual destructor for all descendants:
virtual ~cListenCallbacks() {}
- /** Called when the TCP server created with Listen() accepts an incoming connection.
- Provides the newly created Link that can be used for communication. */
+ /** Called when the TCP server created with Listen() receives a new incoming connection.
+ Returns the link callbacks that the server should use for the newly created link.
+ If a nullptr is returned, the connection is dropped immediately;
+ otherwise a new cTCPLink instance is created and OnAccepted() is called. */
+ virtual cTCPLink::cCallbacksPtr OnIncomingConnection(const AString & a_RemoteIPAddress, UInt16 a_RemotePort) = 0;
+
+ /** Called when the TCP server created with Listen() creates a new link for an incoming connection.
+ Provides the newly created Link that can be used for communication.
+ Called right after a successful OnIncomingConnection(). */
virtual void OnAccepted(cTCPLink & a_Link) = 0;
/** Called when the socket fails to listen on the specified port. */
@@ -180,7 +187,7 @@ public:
Implemented in TCPLinkImpl.cpp. */
static bool Connect(
const AString & a_Host,
- const UInt16 a_Port,
+ UInt16 a_Port,
cConnectCallbacksPtr a_ConnectCallbacks,
cTCPLink::cCallbacksPtr a_LinkCallbacks
);
@@ -192,9 +199,8 @@ public:
Returns a cServerHandle that can be used to query the operation status and close the server.
Implemented in ServerHandleImpl.cpp. */
static cServerHandlePtr Listen(
- const UInt16 a_Port,
- cListenCallbacksPtr a_ListenCallbacks,
- cTCPLink::cCallbacksPtr a_LinkCallbacks
+ UInt16 a_Port,
+ cListenCallbacksPtr a_ListenCallbacks
);