Patch by Jerry for issue 46:

- Unit test for sending file data from server to client.
- Removed singleton pattern from CSocketMultiplexer for easier unit testing.
- Incremented protocol version from 1.4 to 1.5 (new file chunk message).
- Storing pointer to CConfig instead of copying in CServer (so we can mock it).
- Created a common event queue for testing (timeout, quit event, etc).
- Fixed code style.
This commit is contained in:
Nick Bolton 2013-07-16 19:02:30 +00:00
parent 6f97f1d186
commit c368013f13
56 changed files with 830 additions and 165 deletions

View file

@ -670,8 +670,11 @@ CClientListener*
CServerApp::openClientListener(const CNetworkAddress& address)
{
CClientListener* listen = new CClientListener(
address, new CTCPSocketFactory(m_events),
NULL, args().m_crypto, m_events);
address,
new CTCPSocketFactory(m_events, getSocketMultiplexer()),
NULL,
args().m_crypto,
m_events);
m_events->adoptHandler(
m_events->forCClientListener().connected(), listen,
@ -682,7 +685,7 @@ CServerApp::openClientListener(const CNetworkAddress& address)
}
CServer*
CServerApp::openServer(const CConfig& config, CPrimaryClient* primaryClient)
CServerApp::openServer(CConfig& config, CPrimaryClient* primaryClient)
{
CServer* server = new CServer(config, primaryClient, s_serverScreen, m_events);
@ -720,6 +723,7 @@ CServerApp::mainLoop()
// create socket multiplexer. this must happen after daemonization
// on unix because threads evaporate across a fork().
CSocketMultiplexer multiplexer;
setSocketMultiplexer(&multiplexer);
// if configuration has no screens then add this system
// as the default