removed connecion less channel class since it is not required

This commit is contained in:
Volker Fischer 2011-04-06 19:01:39 +00:00
parent 1f1e36876e
commit 24f707f2e7
8 changed files with 49 additions and 109 deletions

View file

@ -548,25 +548,3 @@ int CChannel::GetUploadRateKbps()
8 /* bits per byte */ * 8 /* bits per byte */ *
SYSTEM_SAMPLE_RATE_HZ / iAudioSizeOut / 1000; SYSTEM_SAMPLE_RATE_HZ / iAudioSizeOut / 1000;
} }
// CConnectionLessChannel implementation ***************************************
CConnectionLessChannel::CConnectionLessChannel()
{
// Connections -------------------------------------------------------------
QObject::connect ( &Protocol,
SIGNAL ( CLMessReadyForSending ( CHostAddress, CVector<uint8_t> ) ),
SIGNAL ( CLMessReadyForSending ( CHostAddress, CVector<uint8_t> ) ) );
QObject::connect( &Protocol,
SIGNAL ( CLPingReceived ( CHostAddress, int ) ),
SIGNAL ( CLPingReceived ( CHostAddress, int ) ) );
QObject::connect( &Protocol,
SIGNAL ( CLRegisterServerReceived ( CHostAddress, CServerCoreInfo ) ),
SIGNAL ( CLRegisterServerReceived ( CHostAddress, CServerCoreInfo ) ) );
QObject::connect( &Protocol,
SIGNAL ( CLSendEmptyMes ( CHostAddress ) ),
SIGNAL ( CLSendEmptyMes ( CHostAddress ) ) );
}

View file

@ -189,43 +189,4 @@ signals:
void Disconnected(); void Disconnected();
}; };
class CConnectionLessChannel : public QObject
{
Q_OBJECT
public:
CConnectionLessChannel();
bool ParseConnectionLessMessage ( const CVector<uint8_t>& vecbyData,
const int iNumBytes,
const CHostAddress& InetAddr )
{
return Protocol.ParseConnectionLessMessage ( vecbyData, iNumBytes, InetAddr );
}
void CreateCLServerFullMes ( const CHostAddress& InetAddr )
{ Protocol.CreateCLServerFullMes ( InetAddr ); }
void CreateCLPingMes ( const CHostAddress& InetAddr, const int iMs )
{ Protocol.CreateCLPingMes ( InetAddr, iMs ); }
void CreateCLEmptyMes ( const CHostAddress& InetAddr )
{ Protocol.CreateCLEmptyMes ( InetAddr ); }
protected:
// network protocol
CProtocol Protocol;
signals:
void CLMessReadyForSending ( CHostAddress InetAddr,
CVector<uint8_t> vecMessage );
void CLPingReceived ( CHostAddress InetAddr, int iMs );
void CLRegisterServerReceived ( CHostAddress InetAddr,
CServerCoreInfo ServerInfo );
void CLSendEmptyMes ( CHostAddress TargetInetAddr );
};
#endif /* !defined ( CHANNEL_HOIH9345KJH98_3_4344_BB23945IUHF1912__INCLUDED_ ) */ #endif /* !defined ( CHANNEL_HOIH9345KJH98_3_4344_BB23945IUHF1912__INCLUDED_ ) */

View file

@ -34,7 +34,7 @@ CClient::CClient ( const quint16 iPortNumber ) :
iCeltNumCodedBytes ( CELT_NUM_BYTES_MONO_NORMAL_QUALITY ), iCeltNumCodedBytes ( CELT_NUM_BYTES_MONO_NORMAL_QUALITY ),
bCeltDoHighQuality ( false ), bCeltDoHighQuality ( false ),
bUseStereo ( false ), bUseStereo ( false ),
Socket ( &Channel, &ConnLessChannel, iPortNumber ), Socket ( &Channel, &ConnLessProtocol, iPortNumber ),
Sound ( AudioCallback, this ), Sound ( AudioCallback, this ),
iAudioInFader ( AUD_FADER_IN_MIDDLE ), iAudioInFader ( AUD_FADER_IN_MIDDLE ),
bReverbOnLeftChan ( false ), bReverbOnLeftChan ( false ),
@ -113,11 +113,11 @@ CClient::CClient ( const quint16 iPortNumber ) :
QObject::connect ( &Channel, SIGNAL ( PingReceived ( int ) ), QObject::connect ( &Channel, SIGNAL ( PingReceived ( int ) ),
this, SLOT ( OnReceivePingMessage ( int ) ) ); this, SLOT ( OnReceivePingMessage ( int ) ) );
QObject::connect ( &ConnLessChannel, QObject::connect ( &ConnLessProtocol,
SIGNAL ( CLMessReadyForSending ( CHostAddress, CVector<uint8_t> ) ), SIGNAL ( CLMessReadyForSending ( CHostAddress, CVector<uint8_t> ) ),
this, SLOT ( OnSendCLProtMessage ( CHostAddress, CVector<uint8_t> ) ) ); this, SLOT ( OnSendCLProtMessage ( CHostAddress, CVector<uint8_t> ) ) );
QObject::connect ( &ConnLessChannel, SIGNAL ( CLPingReceived ( CHostAddress, int ) ), QObject::connect ( &ConnLessProtocol, SIGNAL ( CLPingReceived ( CHostAddress, int ) ),
this, SLOT ( OnCLPingReceived ( CHostAddress, int ) ) ); this, SLOT ( OnCLPingReceived ( CHostAddress, int ) ) );
QObject::connect ( &Sound, SIGNAL ( ReinitRequest() ), QObject::connect ( &Sound, SIGNAL ( ReinitRequest() ),

View file

@ -212,7 +212,7 @@ public:
{ Channel.CreatePingMes ( PreparePingMessage() ); }; { Channel.CreatePingMes ( PreparePingMessage() ); };
void SendCLPingMess ( const CHostAddress& InetAddr ) void SendCLPingMess ( const CHostAddress& InetAddr )
{ ConnLessChannel.CreateCLPingMes ( InetAddr, PreparePingMessage() ); }; { ConnLessProtocol.CreateCLPingMes ( InetAddr, PreparePingMessage() ); };
int EstimatedOverallDelay ( const int iPingTimeMs ); int EstimatedOverallDelay ( const int iPingTimeMs );
@ -241,7 +241,7 @@ protected:
// only one channel is needed for client application // only one channel is needed for client application
CChannel Channel; CChannel Channel;
CConnectionLessChannel ConnLessChannel; CProtocol ConnLessProtocol;
bool bDoAutoSockBufSize; bool bDoAutoSockBufSize;
// audio encoder/decoder // audio encoder/decoder

View file

@ -275,19 +275,19 @@ CServer::CServer ( const QString& strLoggingFileName,
QObject::connect ( &HighPrecisionTimer, SIGNAL ( timeout() ), QObject::connect ( &HighPrecisionTimer, SIGNAL ( timeout() ),
this, SLOT ( OnTimer() ) ); this, SLOT ( OnTimer() ) );
QObject::connect ( &ConnLessChannel, QObject::connect ( &ConnLessProtocol,
SIGNAL ( CLMessReadyForSending ( CHostAddress, CVector<uint8_t> ) ), SIGNAL ( CLMessReadyForSending ( CHostAddress, CVector<uint8_t> ) ),
this, SLOT ( OnSendCLProtMessage ( CHostAddress, CVector<uint8_t> ) ) ); this, SLOT ( OnSendCLProtMessage ( CHostAddress, CVector<uint8_t> ) ) );
QObject::connect ( &ConnLessChannel, QObject::connect ( &ConnLessProtocol,
SIGNAL ( CLPingReceived ( CHostAddress, int ) ), SIGNAL ( CLPingReceived ( CHostAddress, int ) ),
this, SLOT ( OnCLPingReceived ( CHostAddress, int ) ) ); this, SLOT ( OnCLPingReceived ( CHostAddress, int ) ) );
QObject::connect ( &ConnLessChannel, QObject::connect ( &ConnLessProtocol,
SIGNAL ( CLRegisterServerReceived ( CHostAddress, CServerCoreInfo ) ), SIGNAL ( CLRegisterServerReceived ( CHostAddress, CServerCoreInfo ) ),
this, SLOT ( OnCLRegisterServerReceived ( CHostAddress, CServerCoreInfo ) ) ); this, SLOT ( OnCLRegisterServerReceived ( CHostAddress, CServerCoreInfo ) ) );
QObject::connect ( &ConnLessChannel, QObject::connect ( &ConnLessProtocol,
SIGNAL ( CLSendEmptyMes ( CHostAddress ) ), SIGNAL ( CLSendEmptyMes ( CHostAddress ) ),
this, SLOT ( OnCLSendEmptyMes ( CHostAddress ) ) ); this, SLOT ( OnCLSendEmptyMes ( CHostAddress ) ) );
@ -903,7 +903,7 @@ bool CServer::PutData ( const CVector<uint8_t>& vecbyRecBuf,
{ {
// this is a new client, we then first check if this is a connection // this is a new client, we then first check if this is a connection
// less message before we create a new official channel // less message before we create a new official channel
if ( ConnLessChannel.ParseConnectionLessMessage ( vecbyRecBuf, if ( ConnLessProtocol.ParseConnectionLessMessage ( vecbyRecBuf,
iNumBytesRead, iNumBytesRead,
HostAdr ) ) HostAdr ) )
{ {
@ -939,7 +939,7 @@ bool CServer::PutData ( const CVector<uint8_t>& vecbyRecBuf,
bChanOK = false; bChanOK = false;
// create and send "server full" message // create and send "server full" message
ConnLessChannel.CreateCLServerFullMes ( HostAdr ); ConnLessProtocol.CreateCLServerFullMes ( HostAdr );
} }
} }
} }

View file

@ -153,7 +153,7 @@ protected:
// do not use the vector class since CChannel does not have appropriate // do not use the vector class since CChannel does not have appropriate
// copy constructor/operator // copy constructor/operator
CChannel vecChannels[MAX_NUM_CHANNELS]; CChannel vecChannels[MAX_NUM_CHANNELS];
CConnectionLessChannel ConnLessChannel; CProtocol ConnLessProtocol;
QMutex Mutex; QMutex Mutex;
// audio encoder/decoder // audio encoder/decoder
@ -190,10 +190,10 @@ public slots:
void OnSendCLProtMessage ( CHostAddress InetAddr, CVector<uint8_t> vecMessage ); void OnSendCLProtMessage ( CHostAddress InetAddr, CVector<uint8_t> vecMessage );
void OnCLPingReceived ( CHostAddress InetAddr, int iMs ) void OnCLPingReceived ( CHostAddress InetAddr, int iMs )
{ ConnLessChannel.CreateCLPingMes ( InetAddr, iMs ); } { ConnLessProtocol.CreateCLPingMes ( InetAddr, iMs ); }
void OnCLSendEmptyMes ( CHostAddress TargetInetAddr ) void OnCLSendEmptyMes ( CHostAddress TargetInetAddr )
{ ConnLessChannel.CreateCLEmptyMes ( TargetInetAddr ); } { ConnLessProtocol.CreateCLEmptyMes ( TargetInetAddr ); }
void OnCLRegisterServerReceived ( CHostAddress InetAddr, void OnCLRegisterServerReceived ( CHostAddress InetAddr,
CServerCoreInfo ServerInfo ) CServerCoreInfo ServerInfo )

View file

@ -111,7 +111,7 @@ void CSocket::OnDataReceived()
{ {
// this is an unknown address, try to parse connection less // this is an unknown address, try to parse connection less
// message // message
pConnLessChannel->ParseConnectionLessMessage ( vecbyRecBuf, pConnLessProtocol->ParseConnectionLessMessage ( vecbyRecBuf,
iNumBytesRead, iNumBytesRead,
RecHostAddr ); RecHostAddr );

View file

@ -33,6 +33,7 @@
#include <vector> #include <vector>
#include "global.h" #include "global.h"
#include "channel.h" #include "channel.h"
#include "protocol.h"
#include "util.h" #include "util.h"
// The header file server.h requires to include this header file so we get a // The header file server.h requires to include this header file so we get a
@ -48,9 +49,9 @@ class CSocket : public QObject
public: public:
CSocket ( CChannel* pNewChannel, CSocket ( CChannel* pNewChannel,
CConnectionLessChannel* pNewCLChannel, CProtocol* pNewCLProtocol,
const quint16 iPortNumber ) const quint16 iPortNumber )
: pChannel( pNewChannel ), pConnLessChannel ( pNewCLChannel ), : pChannel( pNewChannel ), pConnLessProtocol ( pNewCLProtocol ),
bIsClient ( true ) { Init ( iPortNumber ); } bIsClient ( true ) { Init ( iPortNumber ); }
CSocket ( CServer* pNServP, CSocket ( CServer* pNServP,
@ -70,7 +71,7 @@ protected:
CHostAddress RecHostAddr; CHostAddress RecHostAddr;
CChannel* pChannel; // for client CChannel* pChannel; // for client
CConnectionLessChannel* pConnLessChannel; // for client CProtocol* pConnLessProtocol; // for client
CServer* pServer; // for server CServer* pServer; // for server
bool bIsClient; bool bIsClient;