dropped prefix C

This commit is contained in:
XinyuHou 2015-01-12 10:33:29 +00:00
parent 7bff958422
commit f973d1498d
9 changed files with 55 additions and 55 deletions

View File

@ -58,7 +58,7 @@ private:
private:
NetworkAddress m_serverAddress;
CTCPSocket m_socket;
TCPSocket m_socket;
IpcServerProxy* m_server;
IEventQueue* m_events;
};

View File

@ -110,7 +110,7 @@ TCPListenSocket::accept()
{
IDataSocket* socket = NULL;
try {
socket = new CTCPSocket(m_events, m_socketMultiplexer, ARCH->acceptSocket(m_socket, NULL));
socket = new TCPSocket(m_events, m_socketMultiplexer, ARCH->acceptSocket(m_socket, NULL));
if (socket != NULL) {
m_socketMultiplexer->addSocket(this,
new TSocketMultiplexerMethodJob<TCPListenSocket>(

View File

@ -34,10 +34,10 @@
#include <memory>
//
// CTCPSocket
// TCPSocket
//
CTCPSocket::CTCPSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer) :
TCPSocket::TCPSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer) :
IDataSocket(events),
m_mutex(),
m_flushed(&m_mutex, true),
@ -54,7 +54,7 @@ CTCPSocket::CTCPSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer
init();
}
CTCPSocket::CTCPSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer, ArchSocket socket) :
TCPSocket::TCPSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer, ArchSocket socket) :
IDataSocket(events),
m_mutex(),
m_socket(socket),
@ -70,7 +70,7 @@ CTCPSocket::CTCPSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer
setJob(newJob());
}
CTCPSocket::~CTCPSocket()
TCPSocket::~TCPSocket()
{
try {
close();
@ -81,7 +81,7 @@ CTCPSocket::~CTCPSocket()
}
void
CTCPSocket::bind(const NetworkAddress& addr)
TCPSocket::bind(const NetworkAddress& addr)
{
try {
ARCH->bindSocket(m_socket, addr.getAddress());
@ -95,7 +95,7 @@ CTCPSocket::bind(const NetworkAddress& addr)
}
void
CTCPSocket::close()
TCPSocket::close()
{
// remove ourself from the multiplexer
setJob(NULL);
@ -123,13 +123,13 @@ CTCPSocket::close()
}
void*
CTCPSocket::getEventTarget() const
TCPSocket::getEventTarget() const
{
return const_cast<void*>(reinterpret_cast<const void*>(this));
}
UInt32
CTCPSocket::read(void* buffer, UInt32 n)
TCPSocket::read(void* buffer, UInt32 n)
{
// copy data directly from our input buffer
Lock lock(&m_mutex);
@ -152,7 +152,7 @@ CTCPSocket::read(void* buffer, UInt32 n)
}
void
CTCPSocket::write(const void* buffer, UInt32 n)
TCPSocket::write(const void* buffer, UInt32 n)
{
bool wasEmpty;
{
@ -184,7 +184,7 @@ CTCPSocket::write(const void* buffer, UInt32 n)
}
void
CTCPSocket::flush()
TCPSocket::flush()
{
Lock lock(&m_mutex);
while (m_flushed == false) {
@ -193,7 +193,7 @@ CTCPSocket::flush()
}
void
CTCPSocket::shutdownInput()
TCPSocket::shutdownInput()
{
bool useNewJob = false;
{
@ -220,7 +220,7 @@ CTCPSocket::shutdownInput()
}
void
CTCPSocket::shutdownOutput()
TCPSocket::shutdownOutput()
{
bool useNewJob = false;
{
@ -247,21 +247,21 @@ CTCPSocket::shutdownOutput()
}
bool
CTCPSocket::isReady() const
TCPSocket::isReady() const
{
Lock lock(&m_mutex);
return (m_inputBuffer.getSize() > 0);
}
UInt32
CTCPSocket::getSize() const
TCPSocket::getSize() const
{
Lock lock(&m_mutex);
return m_inputBuffer.getSize();
}
void
CTCPSocket::connect(const NetworkAddress& addr)
TCPSocket::connect(const NetworkAddress& addr)
{
{
Lock lock(&m_mutex);
@ -290,7 +290,7 @@ CTCPSocket::connect(const NetworkAddress& addr)
}
void
CTCPSocket::init()
TCPSocket::init()
{
// default state
m_connected = false;
@ -316,7 +316,7 @@ CTCPSocket::init()
}
void
CTCPSocket::setJob(ISocketMultiplexerJob* job)
TCPSocket::setJob(ISocketMultiplexerJob* job)
{
// multiplexer will delete the old job
if (job == NULL) {
@ -328,7 +328,7 @@ CTCPSocket::setJob(ISocketMultiplexerJob* job)
}
ISocketMultiplexerJob*
CTCPSocket::newJob()
TCPSocket::newJob()
{
// note -- must have m_mutex locked on entry
@ -340,23 +340,23 @@ CTCPSocket::newJob()
if (!(m_readable || m_writable)) {
return NULL;
}
return new TSocketMultiplexerMethodJob<CTCPSocket>(
this, &CTCPSocket::serviceConnecting,
return new TSocketMultiplexerMethodJob<TCPSocket>(
this, &TCPSocket::serviceConnecting,
m_socket, m_readable, m_writable);
}
else {
if (!(m_readable || (m_writable && (m_outputBuffer.getSize() > 0)))) {
return NULL;
}
return new TSocketMultiplexerMethodJob<CTCPSocket>(
this, &CTCPSocket::serviceConnected,
return new TSocketMultiplexerMethodJob<TCPSocket>(
this, &TCPSocket::serviceConnected,
m_socket, m_readable,
m_writable && (m_outputBuffer.getSize() > 0));
}
}
void
CTCPSocket::sendConnectionFailedEvent(const char* msg)
TCPSocket::sendConnectionFailedEvent(const char* msg)
{
ConnectionFailedInfo* info = new ConnectionFailedInfo(msg);
m_events->addEvent(Event(m_events->forIDataSocket().connectionFailed(),
@ -364,13 +364,13 @@ CTCPSocket::sendConnectionFailedEvent(const char* msg)
}
void
CTCPSocket::sendEvent(Event::Type type)
TCPSocket::sendEvent(Event::Type type)
{
m_events->addEvent(Event(type, getEventTarget(), NULL));
}
void
CTCPSocket::onConnected()
TCPSocket::onConnected()
{
m_connected = true;
m_readable = true;
@ -378,14 +378,14 @@ CTCPSocket::onConnected()
}
void
CTCPSocket::onInputShutdown()
TCPSocket::onInputShutdown()
{
m_inputBuffer.pop(m_inputBuffer.getSize());
m_readable = false;
}
void
CTCPSocket::onOutputShutdown()
TCPSocket::onOutputShutdown()
{
m_outputBuffer.pop(m_outputBuffer.getSize());
m_writable = false;
@ -396,7 +396,7 @@ CTCPSocket::onOutputShutdown()
}
void
CTCPSocket::onDisconnected()
TCPSocket::onDisconnected()
{
// disconnected
onInputShutdown();
@ -405,7 +405,7 @@ CTCPSocket::onDisconnected()
}
ISocketMultiplexerJob*
CTCPSocket::serviceConnecting(ISocketMultiplexerJob* job,
TCPSocket::serviceConnecting(ISocketMultiplexerJob* job,
bool, bool write, bool error)
{
Lock lock(&m_mutex);
@ -449,7 +449,7 @@ CTCPSocket::serviceConnecting(ISocketMultiplexerJob* job,
}
ISocketMultiplexerJob*
CTCPSocket::serviceConnected(ISocketMultiplexerJob* job,
TCPSocket::serviceConnected(ISocketMultiplexerJob* job,
bool read, bool write, bool error)
{
Lock lock(&m_mutex);

View File

@ -34,11 +34,11 @@ class SocketMultiplexer;
/*!
A data socket using TCP.
*/
class CTCPSocket : public IDataSocket {
class TCPSocket : public IDataSocket {
public:
CTCPSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer);
CTCPSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer, ArchSocket socket);
~CTCPSocket();
TCPSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer);
TCPSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer, ArchSocket socket);
~TCPSocket();
// ISocket overrides
virtual void bind(const NetworkAddress&);

View File

@ -22,29 +22,29 @@
#include "net/TCPListenSocket.h"
//
// CTCPSocketFactory
// TCPSocketFactory
//
CTCPSocketFactory::CTCPSocketFactory(IEventQueue* events, SocketMultiplexer* socketMultiplexer) :
TCPSocketFactory::TCPSocketFactory(IEventQueue* events, SocketMultiplexer* socketMultiplexer) :
m_events(events),
m_socketMultiplexer(socketMultiplexer)
{
// do nothing
}
CTCPSocketFactory::~CTCPSocketFactory()
TCPSocketFactory::~TCPSocketFactory()
{
// do nothing
}
IDataSocket*
CTCPSocketFactory::create() const
TCPSocketFactory::create() const
{
return new CTCPSocket(m_events, m_socketMultiplexer);
return new TCPSocket(m_events, m_socketMultiplexer);
}
IListenSocket*
CTCPSocketFactory::createListen() const
TCPSocketFactory::createListen() const
{
return new TCPListenSocket(m_events, m_socketMultiplexer);
}

View File

@ -24,10 +24,10 @@ class IEventQueue;
class SocketMultiplexer;
//! Socket factory for TCP sockets
class CTCPSocketFactory : public ISocketFactory {
class TCPSocketFactory : public ISocketFactory {
public:
CTCPSocketFactory(IEventQueue* events, SocketMultiplexer* socketMultiplexer);
virtual ~CTCPSocketFactory();
TCPSocketFactory(IEventQueue* events, SocketMultiplexer* socketMultiplexer);
virtual ~TCPSocketFactory();
// ISocketFactory overrides
virtual IDataSocket* create() const;

View File

@ -340,7 +340,7 @@ ClientApp::openClient(const String& name, const NetworkAddress& address,
m_events,
name,
address,
new CTCPSocketFactory(m_events, getSocketMultiplexer()),
new TCPSocketFactory(m_events, getSocketMultiplexer()),
NULL,
screen,
crypto,

View File

@ -631,7 +631,7 @@ ServerApp::openClientListener(const NetworkAddress& address)
{
ClientListener* listen = new ClientListener(
address,
new CTCPSocketFactory(m_events, getSocketMultiplexer()),
new TCPSocketFactory(m_events, getSocketMultiplexer()),
NULL,
args().m_crypto,
m_events);

View File

@ -115,7 +115,7 @@ TEST_F(NetworkTests, sendToClient_mockData)
// server
SocketMultiplexer serverSocketMultiplexer;
CTCPSocketFactory* serverSocketFactory = new CTCPSocketFactory(&m_events, &serverSocketMultiplexer);
TCPSocketFactory* serverSocketFactory = new TCPSocketFactory(&m_events, &serverSocketMultiplexer);
ClientListener listener(serverAddress, serverSocketFactory, NULL, cryptoOptions, &m_events);
NiceMock<MockScreen> serverScreen;
NiceMock<MockPrimaryClient> primaryClient;
@ -137,7 +137,7 @@ TEST_F(NetworkTests, sendToClient_mockData)
// client
NiceMock<MockScreen> clientScreen;
SocketMultiplexer clientSocketMultiplexer;
CTCPSocketFactory* clientSocketFactory = new CTCPSocketFactory(&m_events, &clientSocketMultiplexer);
TCPSocketFactory* clientSocketFactory = new TCPSocketFactory(&m_events, &clientSocketMultiplexer);
ON_CALL(clientScreen, getShape(_, _, _, _)).WillByDefault(Invoke(getScreenShape));
ON_CALL(clientScreen, getCursorPos(_, _)).WillByDefault(Invoke(getCursorPos));
@ -168,7 +168,7 @@ TEST_F(NetworkTests, sendToClient_mockFile)
// server
SocketMultiplexer serverSocketMultiplexer;
CTCPSocketFactory* serverSocketFactory = new CTCPSocketFactory(&m_events, &serverSocketMultiplexer);
TCPSocketFactory* serverSocketFactory = new TCPSocketFactory(&m_events, &serverSocketMultiplexer);
ClientListener listener(serverAddress, serverSocketFactory, NULL, cryptoOptions, &m_events);
NiceMock<MockScreen> serverScreen;
NiceMock<MockPrimaryClient> primaryClient;
@ -190,7 +190,7 @@ TEST_F(NetworkTests, sendToClient_mockFile)
// client
NiceMock<MockScreen> clientScreen;
SocketMultiplexer clientSocketMultiplexer;
CTCPSocketFactory* clientSocketFactory = new CTCPSocketFactory(&m_events, &clientSocketMultiplexer);
TCPSocketFactory* clientSocketFactory = new TCPSocketFactory(&m_events, &clientSocketMultiplexer);
ON_CALL(clientScreen, getShape(_, _, _, _)).WillByDefault(Invoke(getScreenShape));
ON_CALL(clientScreen, getCursorPos(_, _)).WillByDefault(Invoke(getCursorPos));
@ -221,7 +221,7 @@ TEST_F(NetworkTests, sendToServer_mockData)
// server
SocketMultiplexer serverSocketMultiplexer;
CTCPSocketFactory* serverSocketFactory = new CTCPSocketFactory(&m_events, &serverSocketMultiplexer);
TCPSocketFactory* serverSocketFactory = new TCPSocketFactory(&m_events, &serverSocketMultiplexer);
ClientListener listener(serverAddress, serverSocketFactory, NULL, cryptoOptions, &m_events);
NiceMock<MockScreen> serverScreen;
NiceMock<MockPrimaryClient> primaryClient;
@ -238,7 +238,7 @@ TEST_F(NetworkTests, sendToServer_mockData)
// client
NiceMock<MockScreen> clientScreen;
SocketMultiplexer clientSocketMultiplexer;
CTCPSocketFactory* clientSocketFactory = new CTCPSocketFactory(&m_events, &clientSocketMultiplexer);
TCPSocketFactory* clientSocketFactory = new TCPSocketFactory(&m_events, &clientSocketMultiplexer);
ON_CALL(clientScreen, getShape(_, _, _, _)).WillByDefault(Invoke(getScreenShape));
ON_CALL(clientScreen, getCursorPos(_, _)).WillByDefault(Invoke(getCursorPos));
@ -274,7 +274,7 @@ TEST_F(NetworkTests, sendToServer_mockFile)
// server
SocketMultiplexer serverSocketMultiplexer;
CTCPSocketFactory* serverSocketFactory = new CTCPSocketFactory(&m_events, &serverSocketMultiplexer);
TCPSocketFactory* serverSocketFactory = new TCPSocketFactory(&m_events, &serverSocketMultiplexer);
ClientListener listener(serverAddress, serverSocketFactory, NULL, cryptoOptions, &m_events);
NiceMock<MockScreen> serverScreen;
NiceMock<MockPrimaryClient> primaryClient;
@ -291,7 +291,7 @@ TEST_F(NetworkTests, sendToServer_mockFile)
// client
NiceMock<MockScreen> clientScreen;
SocketMultiplexer clientSocketMultiplexer;
CTCPSocketFactory* clientSocketFactory = new CTCPSocketFactory(&m_events, &clientSocketMultiplexer);
TCPSocketFactory* clientSocketFactory = new TCPSocketFactory(&m_events, &clientSocketMultiplexer);
ON_CALL(clientScreen, getShape(_, _, _, _)).WillByDefault(Invoke(getScreenShape));
ON_CALL(clientScreen, getCursorPos(_, _)).WillByDefault(Invoke(getCursorPos));