diff options
author | Mattes D <github@xoft.cz> | 2015-01-30 21:24:02 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-02-04 08:40:52 +0100 |
commit | 014b96adb33fa902072d9f35661bc4f5e7c323e8 (patch) | |
tree | 46dcb57a65829d6364cbabec7add4021b9008ee6 /src/Bindings/LuaTCPLink.h | |
parent | cNetwork: Exported lookup functions to Lua API. (diff) | |
download | cuberite-014b96adb33fa902072d9f35661bc4f5e7c323e8.tar cuberite-014b96adb33fa902072d9f35661bc4f5e7c323e8.tar.gz cuberite-014b96adb33fa902072d9f35661bc4f5e7c323e8.tar.bz2 cuberite-014b96adb33fa902072d9f35661bc4f5e7c323e8.tar.lz cuberite-014b96adb33fa902072d9f35661bc4f5e7c323e8.tar.xz cuberite-014b96adb33fa902072d9f35661bc4f5e7c323e8.tar.zst cuberite-014b96adb33fa902072d9f35661bc4f5e7c323e8.zip |
Diffstat (limited to 'src/Bindings/LuaTCPLink.h')
-rw-r--r-- | src/Bindings/LuaTCPLink.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Bindings/LuaTCPLink.h b/src/Bindings/LuaTCPLink.h index 125cc1b31..f2af911ec 100644 --- a/src/Bindings/LuaTCPLink.h +++ b/src/Bindings/LuaTCPLink.h @@ -16,6 +16,14 @@ +// fwd: +class cLuaServerHandle; +typedef WeakPtr<cLuaServerHandle> cLuaServerHandleWPtr; + + + + + class cLuaTCPLink: public cNetwork::cConnectCallbacks, public cTCPLink::cCallbacks @@ -24,6 +32,11 @@ public: /** Creates a new instance of the link, attached to the specified plugin and wrapping the callbacks that are in a table at the specified stack pos. */ cLuaTCPLink(cPluginLua & a_Plugin, int a_CallbacksTableStackPos); + /** Creates a new instance of the link, attached to the specified plugin and wrapping the callbacks that are in the specified referenced table. */ + cLuaTCPLink(cPluginLua & a_Plugin, cLuaState::cRef && a_CallbacksTableRef, cLuaServerHandleWPtr a_Server); + + ~cLuaTCPLink(); + /** Sends the data contained in the string to the remote peer. Returns true if successful, false on immediate failure (queueing the data failed or link not available). */ bool Send(const AString & a_Data); @@ -60,6 +73,14 @@ protected: May be nullptr. */ cTCPLinkPtr m_Link; + /** The server that is responsible for this link, if any. */ + cLuaServerHandleWPtr m_Server; + + + /** Common code called when the link is considered as terminated. + Releases m_Link, m_Callbacks and this from m_Server, each when applicable. */ + void Terminated(void); + // cNetwork::cConnectCallbacks overrides: virtual void OnConnected(cTCPLink & a_Link) override; virtual void OnError(int a_ErrorCode, const AString & a_ErrorMsg) override; |