#include "stdafx.h"
#include "deNetWinServer.h"
#include "NetUsersDiag.h"
#include "deNetWinMasterServer.hpp"
#include "..\deNet\deConnection.hpp"

deNetWinMasterServer::deNetWinMasterServer(void)
{
}

deNetWinMasterServer::~deNetWinMasterServer(void)
{
}

eNetError	deNetWinMasterServer::OnTick( void )
{
	DWORD i = 0;

	for( i=0; i<m_iNumSlaves; i++ )
	{
		if( m_aSlaves[i] && m_aSlaves[i]->IsReady() )
		{
			CNetUsersDiag::GetWin()->UpdateConnectionInfo( m_aSlaves[i] );
		}
	}

	// set up client(s)
	for( i=0; i<m_iNumClients; i++ )
	{
		if( m_aClients[i] && m_aClients[i]->IsReady() )
		{
			CNetUsersDiag::GetWin()->UpdateConnectionInfo( m_aClients[i] );
		}
	}

	return deMasterServer::OnTick();
}

eNetError	deNetWinMasterServer::OnCustomMsg( deNetMsg * pMsg )
{
	return CODE_OK;
}

eNetError	deNetWinMasterServer::OnAcceptConnection( deConnectionRequest * pRequest, deConnection * pConn )
{
	return CODE_OK;
}

eNetError	deNetWinMasterServer::OnNewConnection( deConnection * pConn )
{
	CNetUsersDiag::GetWin()->AddConnection( pConn );
	return CODE_OK;
}

eNetError	deNetWinMasterServer::OnRemoveConnnection( deConnection * pConn )
{
	CNetUsersDiag::GetWin()->RemoveConnection( pConn );
	return CODE_OK;
}
