summaryrefslogtreecommitdiffstats
path: root/src/OSSupport/TCPLinkImpl.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-02-14 13:55:54 +0100
committerMattes D <github@xoft.cz>2015-02-14 13:55:54 +0100
commitd336a3ea9e581372e225ee64113fe7fd7e080d45 (patch)
treef0d4c8d3a4ce08d2861f3a1f6cd93bd557594966 /src/OSSupport/TCPLinkImpl.h
parentSslContext: Turned debug messages off. (diff)
downloadcuberite-d336a3ea9e581372e225ee64113fe7fd7e080d45.tar
cuberite-d336a3ea9e581372e225ee64113fe7fd7e080d45.tar.gz
cuberite-d336a3ea9e581372e225ee64113fe7fd7e080d45.tar.bz2
cuberite-d336a3ea9e581372e225ee64113fe7fd7e080d45.tar.lz
cuberite-d336a3ea9e581372e225ee64113fe7fd7e080d45.tar.xz
cuberite-d336a3ea9e581372e225ee64113fe7fd7e080d45.tar.zst
cuberite-d336a3ea9e581372e225ee64113fe7fd7e080d45.zip
Diffstat (limited to 'src/OSSupport/TCPLinkImpl.h')
-rw-r--r--src/OSSupport/TCPLinkImpl.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/OSSupport/TCPLinkImpl.h b/src/OSSupport/TCPLinkImpl.h
index 735e8ed9d..bea21aeff 100644
--- a/src/OSSupport/TCPLinkImpl.h
+++ b/src/OSSupport/TCPLinkImpl.h
@@ -94,6 +94,11 @@ protected:
Initialized in Enable(), cleared in Close() and EventCallback(RemoteClosed). */
cTCPLinkImplPtr m_Self;
+ /** If true, Shutdown() has been called and is in queue.
+ No more data is allowed to be sent via Send() and after all the currently buffered
+ data is sent to the OS TCP stack, the socket gets shut down. */
+ bool m_ShouldShutdown;
+
/** Creates a new link to be queued to connect to a specified host:port.
Used for outgoing connections created using cNetwork::Connect().
@@ -104,6 +109,9 @@ protected:
/** Callback that LibEvent calls when there's data available from the remote peer. */
static void ReadCallback(bufferevent * a_BufferEvent, void * a_Self);
+ /** Callback that LibEvent calls when the remote peer can receive more data. */
+ static void WriteCallback(bufferevent * a_BufferEvent, void * a_Self);
+
/** Callback that LibEvent calls when there's a non-data-related event on the socket. */
static void EventCallback(bufferevent * a_BufferEvent, short a_What, void * a_Self);
@@ -115,6 +123,10 @@ protected:
/** Updates m_RemoteIP and m_RemotePort based on the metadata read from the socket. */
void UpdateRemoteAddress(void);
+
+ /** Calls shutdown on the link and disables LibEvent writing.
+ Called after all data from LibEvent buffers is sent to the OS TCP stack and shutdown() has been called before. */
+ void DoActualShutdown(void);
};