resolve #4337 removed IStreamFilterFactory dead code

This commit is contained in:
XinyuHou 2015-01-27 11:33:06 +00:00
parent a53dae9be3
commit d80aa7c938
8 changed files with 8 additions and 72 deletions

View File

@ -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) {

View File

@ -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;

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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;
};

View File

@ -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) {

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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<MockScreen> serverScreen;
NiceMock<MockPrimaryClient> primaryClient;
NiceMock<MockConfig> 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<MockScreen> serverScreen;
NiceMock<MockPrimaryClient> primaryClient;
NiceMock<MockConfig> 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<MockScreen> serverScreen;
NiceMock<MockPrimaryClient> primaryClient;
NiceMock<MockConfig> 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<MockScreen> serverScreen;
NiceMock<MockPrimaryClient> primaryClient;
NiceMock<MockConfig> 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,