From d80aa7c938c6a10b4c5575899ccb8d5c7e5dccc7 Mon Sep 17 00:00:00 2001 From: XinyuHou Date: Tue, 27 Jan 2015 11:33:06 +0000 Subject: [PATCH] resolve #4337 removed IStreamFilterFactory dead code --- src/lib/client/Client.cpp | 7 ----- src/lib/client/Client.h | 4 --- src/lib/io/IStreamFilterFactory.h | 38 ------------------------ src/lib/server/ClientListener.cpp | 9 ------ src/lib/server/ClientListener.h | 4 --- src/lib/synergy/ClientApp.cpp | 1 - src/lib/synergy/ServerApp.cpp | 1 - src/test/integtests/net/NetworkTests.cpp | 16 +++++----- 8 files changed, 8 insertions(+), 72 deletions(-) delete mode 100644 src/lib/io/IStreamFilterFactory.h diff --git a/src/lib/client/Client.cpp b/src/lib/client/Client.cpp index 2dd9819a..2aab195a 100644 --- a/src/lib/client/Client.cpp +++ b/src/lib/client/Client.cpp @@ -30,7 +30,6 @@ #include "synergy/FileChunker.h" #include "synergy/IPlatformScreen.h" #include "mt/Thread.h" -#include "io/IStreamFilterFactory.h" #include "io/CryptoStream.h" #include "net/TCPSocket.h" #include "net/IDataSocket.h" @@ -61,7 +60,6 @@ Client::Client( IEventQueue* events, const String& name, const NetworkAddress& address, ISocketFactory* socketFactory, - IStreamFilterFactory* streamFilterFactory, synergy::Screen* screen, const CryptoOptions& crypto, bool enableDragDrop) : @@ -69,7 +67,6 @@ Client::Client( m_name(name), m_serverAddress(address), m_socketFactory(socketFactory), - m_streamFilterFactory(streamFilterFactory), m_screen(screen), m_stream(NULL), m_timer(NULL), @@ -127,7 +124,6 @@ Client::~Client() cleanupConnecting(); cleanupConnection(); delete m_socketFactory; - delete m_streamFilterFactory; } void @@ -166,9 +162,6 @@ Client::connect() // filter socket messages, including a packetizing filter m_stream = socket; bool adopt = !useSecureSocket; - if (m_streamFilterFactory != NULL) { - m_stream = m_streamFilterFactory->create(m_stream, adopt); - } m_stream = new PacketStreamFilter(m_events, m_stream, adopt); if (m_crypto.m_mode != kDisabled) { diff --git a/src/lib/client/Client.h b/src/lib/client/Client.h index f3437279..b0e23a79 100644 --- a/src/lib/client/Client.h +++ b/src/lib/client/Client.h @@ -33,7 +33,6 @@ class ServerProxy; class IDataSocket; class ISocketFactory; namespace synergy { class IStream; } -class IStreamFilterFactory; class IEventQueue; class CryptoStream; class Thread; @@ -61,7 +60,6 @@ public: Client(IEventQueue* events, const String& name, const NetworkAddress& address, ISocketFactory* socketFactory, - IStreamFilterFactory* streamFilterFactory, synergy::Screen* screen, const CryptoOptions& crypto, bool enableDragDrop); @@ -212,8 +210,6 @@ private: String m_name; NetworkAddress m_serverAddress; ISocketFactory* m_socketFactory; - IStreamFilterFactory* - m_streamFilterFactory; synergy::Screen* m_screen; synergy::IStream* m_stream; EventQueueTimer* m_timer; diff --git a/src/lib/io/IStreamFilterFactory.h b/src/lib/io/IStreamFilterFactory.h deleted file mode 100644 index 334f5d7b..00000000 --- a/src/lib/io/IStreamFilterFactory.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * synergy -- mouse and keyboard sharing utility - * Copyright (C) 2012 Synergy Si Ltd. - * Copyright (C) 2002 Chris Schoeneman - * - * This package is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * found in the file COPYING that should have accompanied this file. - * - * This package is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -#include "common/IInterface.h" - -namespace synergy { class IStream; } - -//! Stream filter factory interface -/*! -This interface provides factory methods to create stream filters. -*/ -class IStreamFilterFactory : public IInterface { -public: - //! Create filter - /*! - Create and return a stream filter on \p stream. The caller must - delete the returned object. - */ - virtual synergy::IStream* - create(synergy::IStream* stream, bool adoptStream) = 0; -}; diff --git a/src/lib/server/ClientListener.cpp b/src/lib/server/ClientListener.cpp index de895781..05171c97 100644 --- a/src/lib/server/ClientListener.cpp +++ b/src/lib/server/ClientListener.cpp @@ -27,7 +27,6 @@ #include "net/XSocket.h" #include "io/CryptoStream.h" #include "io/CryptoOptions.h" -#include "io/IStreamFilterFactory.h" #include "base/Log.h" #include "base/IEventQueue.h" #include "base/TMethodEventJob.h" @@ -44,11 +43,9 @@ static const char s_networkSecurity[] = { "libns" }; ClientListener::ClientListener(const NetworkAddress& address, ISocketFactory* socketFactory, - IStreamFilterFactory* streamFilterFactory, const CryptoOptions& crypto, IEventQueue* events) : m_socketFactory(socketFactory), - m_streamFilterFactory(streamFilterFactory), m_server(NULL), m_crypto(crypto), m_events(events) @@ -67,13 +64,11 @@ ClientListener::ClientListener(const NetworkAddress& address, catch (XSocketAddressInUse&) { cleanupListenSocket(); delete m_socketFactory; - delete m_streamFilterFactory; throw; } catch (XBase&) { cleanupListenSocket(); delete m_socketFactory; - delete m_streamFilterFactory; throw; } LOG((CLOG_DEBUG1 "listening for clients")); @@ -111,7 +106,6 @@ ClientListener::~ClientListener() m_events->removeHandler(m_events->forIListenSocket().connecting(), m_listen); cleanupListenSocket(); delete m_socketFactory; - delete m_streamFilterFactory; } void @@ -144,9 +138,6 @@ ClientListener::handleClientConnecting(const Event&, void*) LOG((CLOG_NOTE "accepted client connection")); // filter socket messages, including a packetizing filter - if (m_streamFilterFactory != NULL) { - stream = m_streamFilterFactory->create(stream, true); - } stream = new PacketStreamFilter(m_events, stream, true); if (m_crypto.m_mode != kDisabled) { diff --git a/src/lib/server/ClientListener.h b/src/lib/server/ClientListener.h index 4e5d4f23..afbb24aa 100644 --- a/src/lib/server/ClientListener.h +++ b/src/lib/server/ClientListener.h @@ -30,7 +30,6 @@ class ClientProxyUnknown; class NetworkAddress; class IListenSocket; class ISocketFactory; -class IStreamFilterFactory; class Server; class IEventQueue; @@ -39,7 +38,6 @@ public: // The factories are adopted. ClientListener(const NetworkAddress&, ISocketFactory*, - IStreamFilterFactory*, const CryptoOptions& crypto, IEventQueue* events); ~ClientListener(); @@ -81,8 +79,6 @@ private: IListenSocket* m_listen; ISocketFactory* m_socketFactory; - IStreamFilterFactory* - m_streamFilterFactory; NewClients m_newClients; WaitingClients m_waitingClients; Server* m_server; diff --git a/src/lib/synergy/ClientApp.cpp b/src/lib/synergy/ClientApp.cpp index b26bc700..30826036 100644 --- a/src/lib/synergy/ClientApp.cpp +++ b/src/lib/synergy/ClientApp.cpp @@ -341,7 +341,6 @@ ClientApp::openClient(const String& name, const NetworkAddress& address, name, address, new TCPSocketFactory(m_events, getSocketMultiplexer()), - NULL, screen, crypto, args().m_enableDragDrop); diff --git a/src/lib/synergy/ServerApp.cpp b/src/lib/synergy/ServerApp.cpp index 6cbc2016..fbd1949e 100644 --- a/src/lib/synergy/ServerApp.cpp +++ b/src/lib/synergy/ServerApp.cpp @@ -632,7 +632,6 @@ ServerApp::openClientListener(const NetworkAddress& address) ClientListener* listen = new ClientListener( address, new TCPSocketFactory(m_events, getSocketMultiplexer()), - NULL, args().m_crypto, m_events); diff --git a/src/test/integtests/net/NetworkTests.cpp b/src/test/integtests/net/NetworkTests.cpp index 38d4d00c..74349718 100644 --- a/src/test/integtests/net/NetworkTests.cpp +++ b/src/test/integtests/net/NetworkTests.cpp @@ -116,7 +116,7 @@ TEST_F(NetworkTests, sendToClient_mockData) // server SocketMultiplexer serverSocketMultiplexer; TCPSocketFactory* serverSocketFactory = new TCPSocketFactory(&m_events, &serverSocketMultiplexer); - ClientListener listener(serverAddress, serverSocketFactory, NULL, cryptoOptions, &m_events); + ClientListener listener(serverAddress, serverSocketFactory, cryptoOptions, &m_events); NiceMock serverScreen; NiceMock primaryClient; NiceMock serverConfig; @@ -142,7 +142,7 @@ TEST_F(NetworkTests, sendToClient_mockData) ON_CALL(clientScreen, getShape(_, _, _, _)).WillByDefault(Invoke(getScreenShape)); ON_CALL(clientScreen, getCursorPos(_, _)).WillByDefault(Invoke(getCursorPos)); - Client client(&m_events, "stub", serverAddress, clientSocketFactory, NULL, &clientScreen, cryptoOptions, true); + Client client(&m_events, "stub", serverAddress, clientSocketFactory, &clientScreen, cryptoOptions, true); m_events.adoptHandler( m_events.forIScreen().fileRecieveCompleted(), &client, @@ -169,7 +169,7 @@ TEST_F(NetworkTests, sendToClient_mockFile) // server SocketMultiplexer serverSocketMultiplexer; TCPSocketFactory* serverSocketFactory = new TCPSocketFactory(&m_events, &serverSocketMultiplexer); - ClientListener listener(serverAddress, serverSocketFactory, NULL, cryptoOptions, &m_events); + ClientListener listener(serverAddress, serverSocketFactory, cryptoOptions, &m_events); NiceMock serverScreen; NiceMock primaryClient; NiceMock serverConfig; @@ -195,7 +195,7 @@ TEST_F(NetworkTests, sendToClient_mockFile) ON_CALL(clientScreen, getShape(_, _, _, _)).WillByDefault(Invoke(getScreenShape)); ON_CALL(clientScreen, getCursorPos(_, _)).WillByDefault(Invoke(getCursorPos)); - Client client(&m_events, "stub", serverAddress, clientSocketFactory, NULL, &clientScreen, cryptoOptions, true); + Client client(&m_events, "stub", serverAddress, clientSocketFactory, &clientScreen, cryptoOptions, true); m_events.adoptHandler( m_events.forIScreen().fileRecieveCompleted(), &client, @@ -222,7 +222,7 @@ TEST_F(NetworkTests, sendToServer_mockData) // server SocketMultiplexer serverSocketMultiplexer; TCPSocketFactory* serverSocketFactory = new TCPSocketFactory(&m_events, &serverSocketMultiplexer); - ClientListener listener(serverAddress, serverSocketFactory, NULL, cryptoOptions, &m_events); + ClientListener listener(serverAddress, serverSocketFactory, cryptoOptions, &m_events); NiceMock serverScreen; NiceMock primaryClient; NiceMock serverConfig; @@ -243,7 +243,7 @@ TEST_F(NetworkTests, sendToServer_mockData) ON_CALL(clientScreen, getShape(_, _, _, _)).WillByDefault(Invoke(getScreenShape)); ON_CALL(clientScreen, getCursorPos(_, _)).WillByDefault(Invoke(getCursorPos)); - Client client(&m_events, "stub", serverAddress, clientSocketFactory, NULL, &clientScreen, cryptoOptions, true); + Client client(&m_events, "stub", serverAddress, clientSocketFactory, &clientScreen, cryptoOptions, true); m_events.adoptHandler( m_events.forClientListener().connected(), &listener, @@ -275,7 +275,7 @@ TEST_F(NetworkTests, sendToServer_mockFile) // server SocketMultiplexer serverSocketMultiplexer; TCPSocketFactory* serverSocketFactory = new TCPSocketFactory(&m_events, &serverSocketMultiplexer); - ClientListener listener(serverAddress, serverSocketFactory, NULL, cryptoOptions, &m_events); + ClientListener listener(serverAddress, serverSocketFactory, cryptoOptions, &m_events); NiceMock serverScreen; NiceMock primaryClient; NiceMock serverConfig; @@ -296,7 +296,7 @@ TEST_F(NetworkTests, sendToServer_mockFile) ON_CALL(clientScreen, getShape(_, _, _, _)).WillByDefault(Invoke(getScreenShape)); ON_CALL(clientScreen, getCursorPos(_, _)).WillByDefault(Invoke(getCursorPos)); - Client client(&m_events, "stub", serverAddress, clientSocketFactory, NULL, &clientScreen, cryptoOptions, true); + Client client(&m_events, "stub", serverAddress, clientSocketFactory, &clientScreen, cryptoOptions, true); m_events.adoptHandler( m_events.forClientListener().connected(), &listener,