From 6ca893920560f2e907962c0b6e9b561ba797da38 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Wed, 11 Oct 2023 10:05:42 +0200 Subject: updated plugin API class names (#462) * renamed some interfaces to improve pluggable transport API TransportConnectionInterface -> TransportConnection TransportPluginInterface -> TransportPlugin TransportServerConnectionHandler -> TransportServerConnection TransportServerInterface -> TransportServer --- src/plugins/winsock/winsock.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/winsock/winsock.cpp b/src/plugins/winsock/winsock.cpp index dca1fdbe7..3ee3f0ccd 100644 --- a/src/plugins/winsock/winsock.cpp +++ b/src/plugins/winsock/winsock.cpp @@ -24,25 +24,25 @@ ZEN_THIRD_PARTY_INCLUDES_END ////////////////////////////////////////////////////////////////////////// -class SocketTransportPlugin : public TransportPluginInterface, zen::RefCounted +class SocketTransportPlugin : public TransportPlugin, zen::RefCounted { public: SocketTransportPlugin(uint16_t BasePort, unsigned int ThreadCount); ~SocketTransportPlugin(); - // TransportPluginInterface implementation + // TransportPlugin implementation virtual uint32_t AddRef() const override; virtual uint32_t Release() const override; - virtual void Initialize(TransportServerInterface* ServerInterface) override; + virtual void Initialize(TransportServer* ServerInterface) override; virtual void Shutdown() override; virtual bool IsAvailable() override; private: - TransportServerInterface* m_ServerInterface = nullptr; - bool m_IsOk = true; - uint16_t m_BasePort = 0; - int m_ThreadCount = 0; + TransportServer* m_ServerInterface = nullptr; + bool m_IsOk = true; + uint16_t m_BasePort = 0; + int m_ThreadCount = 0; SOCKET m_ListenSocket{}; std::thread m_AcceptThread; @@ -50,25 +50,25 @@ private: std::vector> m_Connections; }; -struct SocketTransportConnection : public TransportConnectionInterface +struct SocketTransportConnection : public TransportConnection { public: SocketTransportConnection(); ~SocketTransportConnection(); - void Initialize(TransportServerConnectionHandler* ServerConnection, SOCKET ClientSocket); + void Initialize(TransportServerConnection* ServerConnection, SOCKET ClientSocket); void HandleConnection(); - // TransportConnectionInterface implementation + // TransportConnection implementation virtual int64_t WriteBytes(const void* Buffer, size_t DataSize) override; virtual void Shutdown(bool Receive, bool Transmit) override; virtual void CloseConnection() override; private: - zen::Ref m_ConnectionHandler; - SOCKET m_ClientSocket{}; - bool m_IsTerminated = false; + zen::Ref m_ConnectionHandler; + SOCKET m_ClientSocket{}; + bool m_IsTerminated = false; }; ////////////////////////////////////////////////////////////////////////// @@ -82,7 +82,7 @@ SocketTransportConnection::~SocketTransportConnection() } void -SocketTransportConnection::Initialize(TransportServerConnectionHandler* ServerConnection, SOCKET ClientSocket) +SocketTransportConnection::Initialize(TransportServerConnection* ServerConnection, SOCKET ClientSocket) { // ZEN_ASSERT(!m_ConnectionHandler); @@ -221,7 +221,7 @@ SocketTransportPlugin::Release() const } void -SocketTransportPlugin::Initialize(TransportServerInterface* ServerInterface) +SocketTransportPlugin::Initialize(TransportServer* ServerInterface) { uint16_t Port = m_BasePort; @@ -265,8 +265,8 @@ SocketTransportPlugin::Initialize(TransportServerInterface* ServerInterface) setsockopt(ClientSocket, IPPROTO_TCP, TCP_NODELAY, (char*)&Flag, sizeof(Flag)); // Handle new connection - SocketTransportConnection* Connection = new SocketTransportConnection(); - TransportServerConnectionHandler* ConnectionInterface{m_ServerInterface->CreateConnectionHandler(Connection)}; + SocketTransportConnection* Connection = new SocketTransportConnection(); + TransportServerConnection* ConnectionInterface{m_ServerInterface->CreateConnectionHandler(Connection)}; Connection->Initialize(ConnectionInterface, ClientSocket); m_Connections.push_back(std::async(std::launch::async, [Connection] { @@ -315,8 +315,8 @@ SocketTransportPlugin::IsAvailable() ////////////////////////////////////////////////////////////////////////// -TransportPluginInterface* -CreateTransportPluginInterface() +TransportPlugin* +CreateTransportPlugin() { return new SocketTransportPlugin(1337, 8); } -- cgit v1.2.3