From 6466a4aaf703b6cb272fc57a5ab7ff0d8dbe8b0a Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Fri, 17 May 2019 22:06:48 +0200 Subject: [PATCH] cleanup some 'COMPATIBILITY OLD VERSION, TO BE REMOVED' --- src/audiomixerboard.cpp | 11 +-- src/channel.cpp | 34 --------- src/channel.h | 16 +--- src/client.cpp | 4 - src/client.h | 1 - src/clientdlg.cpp | 4 - src/protocol.cpp | 160 ---------------------------------------- src/protocol.h | 10 +-- src/server.cpp | 4 - src/testbench.h | 12 --- src/util.h | 22 ------ 11 files changed, 6 insertions(+), 272 deletions(-) diff --git a/src/audiomixerboard.cpp b/src/audiomixerboard.cpp index b76cad95..27303ad0 100755 --- a/src/audiomixerboard.cpp +++ b/src/audiomixerboard.cpp @@ -634,15 +634,8 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector& vecChanInf // set the text in the fader vecpChanFader[i]->SetText ( vecChanInfo[j] ); - // update other channel infos (only available for new protocol - // which is not compatible with old versions -> this way we make - // sure that the protocol which transfers only the name does - // change the other client infos) -// #### COMPATIBILITY OLD VERSION, TO BE REMOVED #### -> the "if-condition" can be removed later on... - if ( !vecChanInfo[j].bOnlyNameIsUsed ) - { - vecpChanFader[i]->SetChannelInfos ( vecChanInfo[j] ); - } + // update other channel infos + vecpChanFader[i]->SetChannelInfos ( vecChanInfo[j] ); bFaderIsUsed = true; } diff --git a/src/channel.cpp b/src/channel.cpp index 91dde08d..92938102 100755 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -76,10 +76,6 @@ qRegisterMetaType ( "CHostAddress" ); SIGNAL ( ReqConnClientsList() ), SIGNAL ( ReqConnClientsList() ) ); - QObject::connect ( &Protocol, - SIGNAL ( ConClientListNameMesReceived ( CVector ) ), - SIGNAL ( ConClientListNameMesReceived ( CVector ) ) ); - QObject::connect ( &Protocol, SIGNAL ( ConClientListMesReceived ( CVector ) ), SIGNAL ( ConClientListMesReceived ( CVector ) ) ); @@ -87,9 +83,6 @@ qRegisterMetaType ( "CHostAddress" ); QObject::connect( &Protocol, SIGNAL ( ChangeChanGain ( int, double ) ), this, SLOT ( OnChangeChanGain ( int, double ) ) ); - QObject::connect( &Protocol, SIGNAL ( ChangeChanName ( QString ) ), - this, SLOT ( OnChangeChanName ( QString ) ) ); - QObject::connect( &Protocol, SIGNAL ( ChangeChanInfo ( CChannelCoreInfo ) ), this, SLOT ( OnChangeChanInfo ( CChannelCoreInfo ) ) ); @@ -272,28 +265,6 @@ void CChannel::SetChanInfo ( const CChannelCoreInfo& NChanInf ) } } -void CChannel::SetName ( const QString strNewName ) -{ - bool bNameHasChanged = false; - - Mutex.lock(); - { - // apply value (if different from previous one) - if ( ChannelInfo.strName.compare ( strNewName ) ) - { - ChannelInfo.strName = strNewName; - bNameHasChanged = true; - } - } - Mutex.unlock(); - - // fire message that name has changed - if ( bNameHasChanged ) - { - // the "emit" has to be done outside the mutexed region - emit ChanInfoHasChanged(); - } -} QString CChannel::GetName() { // make sure the string is not written at the same time when it is @@ -348,11 +319,6 @@ void CChannel::OnChangeChanGain ( int iChanID, SetGain ( iChanID, dNewGain ); } -void CChannel::OnChangeChanName ( QString strName ) -{ - SetName ( strName ); -} - void CChannel::OnChangeChanInfo ( CChannelCoreInfo ChanInfo ) { SetChanInfo ( ChanInfo ); diff --git a/src/channel.h b/src/channel.h index 4adaa973..bdfceb2b 100755 --- a/src/channel.h +++ b/src/channel.h @@ -93,19 +93,13 @@ public: const CHostAddress& GetAddress() const { return InetAddr; } void ResetInfo() { ChannelInfo = CChannelCoreInfo(); } // reset does not emit a message - void SetName ( const QString sNNa ); QString GetName(); void SetChanInfo ( const CChannelCoreInfo& NChanInf ); CChannelCoreInfo& GetChanInfo() { return ChannelInfo; } void SetRemoteInfo ( const CChannelCoreInfo ChInfo ) - { - // because of compatibility to old versions, we also have to send the - // channel name message extra -// #### COMPATIBILITY OLD VERSION, TO BE REMOVED #### -Protocol.CreateChanNameMes ( ChInfo.strName ); - Protocol.CreateChanInfoMes ( ChInfo ); - } + { Protocol.CreateChanInfoMes ( ChInfo ); } + void CreateReqChanInfoMes() { Protocol.CreateReqChanInfoMes(); } void SetGain ( const int iChanID, const double dNewGain ); @@ -156,10 +150,6 @@ Protocol.CreateChanNameMes ( ChInfo.strName ); void CreateChatTextMes ( const QString& strChatText ) { Protocol.CreateChatTextMes ( strChatText ); } void CreateLicReqMes ( const ELicenceType eLicenceType ) { Protocol.CreateLicenceRequiredMes ( eLicenceType ); } -// #### COMPATIBILITY OLD VERSION, TO BE REMOVED #### -void CreateConClientListNameMes ( const CVector& vecChanInfo ) - { Protocol.CreateConClientListNameMes ( vecChanInfo ); } - void CreateConClientListMes ( const CVector& vecChanInfo ) { Protocol.CreateConClientListMes ( vecChanInfo ); } @@ -219,7 +209,6 @@ public slots: void OnSendProtMessage ( CVector vecMessage ); void OnJittBufSizeChange ( int iNewJitBufSize ); void OnChangeChanGain ( int iChanID, double dNewGain ); - void OnChangeChanName ( QString strName ); void OnChangeChanInfo ( CChannelCoreInfo ChanInfo ); void OnNetTranspPropsReceived ( CNetworkTransportProps NetworkTransportProps ); void OnReqNetTranspProps(); @@ -256,7 +245,6 @@ signals: void JittBufSizeChanged ( int iNewJitBufSize ); void ServerAutoSockBufSizeChange ( int iNNumFra ); void ReqConnClientsList(); - void ConClientListNameMesReceived ( CVector vecChanInfo ); void ConClientListMesReceived ( CVector vecChanInfo ); void ChanInfoHasChanged(); void ReqChanInfo(); diff --git a/src/client.cpp b/src/client.cpp index 0b511686..c4ba7fd2 100755 --- a/src/client.cpp +++ b/src/client.cpp @@ -140,10 +140,6 @@ CClient::CClient ( const quint16 iPortNumber, QObject::connect ( &Channel, SIGNAL ( ReqChanInfo() ), this, SLOT ( OnReqChanInfo() ) ); - QObject::connect ( &Channel, - SIGNAL ( ConClientListNameMesReceived ( CVector ) ), - SIGNAL ( ConClientListNameMesReceived ( CVector ) ) ); - QObject::connect ( &Channel, SIGNAL ( ConClientListMesReceived ( CVector ) ), SIGNAL ( ConClientListMesReceived ( CVector ) ) ); diff --git a/src/client.h b/src/client.h index 045781e3..7b7f03e6 100755 --- a/src/client.h +++ b/src/client.h @@ -388,7 +388,6 @@ public slots: void OnSndCrdReinitRequest ( int iSndCrdResetType ); signals: - void ConClientListNameMesReceived ( CVector vecChanInfo ); void ConClientListMesReceived ( CVector vecChanInfo ); void ChatTextReceived ( QString strChatText ); void LicenceRequired ( ELicenceType eLicenceType ); diff --git a/src/clientdlg.cpp b/src/clientdlg.cpp index bd7c10be..ce0a2ade 100755 --- a/src/clientdlg.cpp +++ b/src/clientdlg.cpp @@ -442,10 +442,6 @@ CClientDlg::CClientDlg ( CClient* pNCliP, this, SLOT ( OnReverbSelRClicked() ) ); // other - QObject::connect ( pClient, - SIGNAL ( ConClientListNameMesReceived ( CVector ) ), - this, SLOT ( OnConClientListMesReceived ( CVector ) ) ); - QObject::connect ( pClient, SIGNAL ( ConClientListMesReceived ( CVector ) ), this, SLOT ( OnConClientListMesReceived ( CVector ) ) ); diff --git a/src/protocol.cpp b/src/protocol.cpp index c97a317b..bbf1639c 100755 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -64,18 +64,6 @@ MESSAGES (with connection) +-------------------+--------------+ -- PROTMESSID_CONN_CLIENTS_LIST_NAME: IP number and name of connected clients - - for each connected client append following data: - - +-------------------+--------------------+------------------+ ... - | 1 byte channel ID | 4 bytes IP address | 2 bytes number n | ... - +-------------------+--------------------+------------------+ ... - ... ----------------------+ - ... n bytes UTF-8 string | - ... ----------------------+ - - - PROTMESSID_CONN_CLIENTS_LIST: Information about connected clients for each connected client append following data: @@ -99,13 +87,6 @@ MESSAGES (with connection) note: does not have any data -> n = 0 -- PROTMESSID_CHANNEL_NAME: Name of channel - - +------------------+----------------------+ - | 2 bytes number n | n bytes UTF-8 string | - +------------------+----------------------+ - - - PROTMESSID_CHANNEL_INFOS: Information about the channel +-----------------+--------------------+ ... @@ -537,11 +518,6 @@ if ( rand() < ( RAND_MAX / 2 ) ) return false; bRet = EvaluateChanGainMes ( vecbyMesBodyData ); break; -// #### COMPATIBILITY OLD VERSION, TO BE REMOVED #### -case PROTMESSID_CONN_CLIENTS_LIST_NAME: - bRet = EvaluateConClientListNameMes ( vecbyMesBodyData ); - break; - case PROTMESSID_CONN_CLIENTS_LIST: bRet = EvaluateConClientListMes ( vecbyMesBodyData ); break; @@ -550,11 +526,6 @@ case PROTMESSID_CONN_CLIENTS_LIST_NAME: bRet = EvaluateReqConnClientsList(); break; -// #### COMPATIBILITY OLD VERSION, TO BE REMOVED #### -case PROTMESSID_CHANNEL_NAME: - bRet = EvaluateChanNameMes ( vecbyMesBodyData ); - break; - case PROTMESSID_CHANNEL_INFOS: bRet = EvaluateChanInfoMes ( vecbyMesBodyData ); break; @@ -773,90 +744,6 @@ bool CProtocol::EvaluateChanGainMes ( const CVector& vecData ) return false; // no error } -void CProtocol::CreateConClientListNameMes ( const CVector& vecChanInfo ) -{ - const int iNumClients = vecChanInfo.Size(); - - // build data vector - CVector vecData ( 0 ); - int iPos = 0; // init position pointer - - for ( int i = 0; i < iNumClients; i++ ) - { - // convert name string to utf-8 - const QByteArray strUTF8Name = vecChanInfo[i].strName.toUtf8(); - - // size of current list entry - const int iCurListEntrLen = - 1 /* chan ID */ + 4 /* IP addr. */ + - 2 /* utf-8 str. size */ + strUTF8Name.size(); - - // make space for new data - vecData.Enlarge ( iCurListEntrLen ); - - // channel ID (1 byte) - PutValOnStream ( vecData, iPos, - static_cast ( vecChanInfo[i].iChanID ), 1 ); - - // IP address (4 bytes) - PutValOnStream ( vecData, iPos, - static_cast ( vecChanInfo[i].iIpAddr ), 4 ); - - // name string - PutStringUTF8OnStream ( vecData, iPos, strUTF8Name ); - } - - CreateAndSendMessage ( PROTMESSID_CONN_CLIENTS_LIST_NAME, vecData ); -} - -bool CProtocol::EvaluateConClientListNameMes ( const CVector& vecData ) -{ - int iPos = 0; // init position pointer - const int iDataLen = vecData.Size(); - CVector vecChanInfo ( 0 ); - - while ( iPos < iDataLen ) - { - // check size (the next 5 bytes) - if ( ( iDataLen - iPos ) < 5 ) - { - return true; // return error code - } - - // channel ID (1 byte) - const int iChanID = - static_cast ( GetValFromStream ( vecData, iPos, 1 ) ); - - // IP address (4 bytes) - const int iIpAddr = - static_cast ( GetValFromStream ( vecData, iPos, 4 ) ); - - // name - QString strCurStr; - if ( GetStringFromStream ( vecData, - iPos, - MAX_LEN_FADER_TAG, - strCurStr ) ) - { - return true; // return error code - } - - // add channel information to vector - vecChanInfo.Add ( CChannelInfo ( iChanID, iIpAddr, strCurStr ) ); - } - - // check size: all data is read, the position must now be at the end - if ( iPos != iDataLen ) - { - return true; // return error code - } - - // invoke message action - emit ConClientListNameMesReceived ( vecChanInfo ); - - return false; // no error -} - void CProtocol::CreateConClientListMes ( const CVector& vecChanInfo ) { const int iNumClients = vecChanInfo.Size(); @@ -1001,53 +888,6 @@ bool CProtocol::EvaluateReqConnClientsList() return false; // no error } -void CProtocol::CreateChanNameMes ( const QString strName ) -{ - int iPos = 0; // init position pointer - - // convert name string to utf-8 - const QByteArray strUTF8Name = strName.toUtf8(); - - const int iStrUTF8Len = strUTF8Name.size(); // get utf-8 string size - - // size of current list entry - const int iEntrLen = 2 /* utf-8 string size */ + iStrUTF8Len; - - // build data vector - CVector vecData ( iEntrLen ); - - // name string - PutStringUTF8OnStream ( vecData, iPos, strUTF8Name ); - - CreateAndSendMessage ( PROTMESSID_CHANNEL_NAME, vecData ); -} - -bool CProtocol::EvaluateChanNameMes ( const CVector& vecData ) -{ - int iPos = 0; // init position pointer - - // channel name - QString strName; - if ( GetStringFromStream ( vecData, - iPos, - MAX_LEN_FADER_TAG, - strName ) ) - { - return true; // return error code - } - - // check size: all data is read, the position must now be at the end - if ( iPos != vecData.Size() ) - { - return true; // return error code - } - - // invoke message action - emit ChangeChanName ( strName ); - - return false; // no error -} - void CProtocol::CreateChanInfoMes ( const CChannelCoreInfo ChanInfo ) { int iPos = 0; // init position pointer diff --git a/src/protocol.h b/src/protocol.h index a79dcf02..20c93e10 100755 --- a/src/protocol.h +++ b/src/protocol.h @@ -41,10 +41,10 @@ #define PROTMESSID_REQ_JITT_BUF_SIZE 11 // request jitter buffer size #define PROTMESSID_NET_BLSI_FACTOR 12 // OLD (not used anymore) #define PROTMESSID_CHANNEL_GAIN 13 // set channel gain for mix -#define PROTMESSID_CONN_CLIENTS_LIST_NAME 14 // connected client list +#define PROTMESSID_CONN_CLIENTS_LIST_NAME 14 // OLD (not used anymore) #define PROTMESSID_SERVER_FULL 15 // OLD (not used anymore) #define PROTMESSID_REQ_CONN_CLIENTS_LIST 16 // request connected client list -#define PROTMESSID_CHANNEL_NAME 17 // set channel name for fader tag +#define PROTMESSID_CHANNEL_NAME 17 // OLD (not used anymore) #define PROTMESSID_CHAT_TEXT 18 // contains a chat text #define PROTMESSID_PING_MS 19 // OLD (not used anymore) #define PROTMESSID_NETW_TRANSPORT_PROPS 20 // properties for network transport @@ -94,10 +94,8 @@ public: void CreateJitBufMes ( const int iJitBufSize ); void CreateReqJitBufMes(); void CreateChanGainMes ( const int iChanID, const double dGain ); - void CreateConClientListNameMes ( const CVector& vecChanInfo ); void CreateConClientListMes ( const CVector& vecChanInfo ); void CreateReqConnClientsList(); - void CreateChanNameMes ( const QString strName ); void CreateChanInfoMes ( const CChannelCoreInfo ChanInfo ); void CreateReqChanInfoMes(); void CreateChatTextMes ( const QString strChatText ); @@ -211,10 +209,8 @@ protected: bool EvaluateJitBufMes ( const CVector& vecData ); bool EvaluateReqJitBufMes(); bool EvaluateChanGainMes ( const CVector& vecData ); - bool EvaluateConClientListNameMes ( const CVector& vecData ); bool EvaluateConClientListMes ( const CVector& vecData ); bool EvaluateReqConnClientsList(); - bool EvaluateChanNameMes ( const CVector& vecData ); bool EvaluateChanInfoMes ( const CVector& vecData ); bool EvaluateReqChanInfoMes(); bool EvaluateChatTextMes ( const CVector& vecData ); @@ -266,11 +262,9 @@ signals: void ReqJittBufSize(); void ChangeNetwBlSiFact ( int iNewNetwBlSiFact ); void ChangeChanGain ( int iChanID, double dNewGain ); - void ConClientListNameMesReceived ( CVector vecChanInfo ); void ConClientListMesReceived ( CVector vecChanInfo ); void ServerFullMesReceived(); void ReqConnClientsList(); - void ChangeChanName ( QString strName ); void ChangeChanInfo ( CChannelCoreInfo ChanInfo ); void ReqChanInfo(); void ChatTextReceived ( QString strChatText ); diff --git a/src/server.cpp b/src/server.cpp index 4437d242..113d7d5f 100755 --- a/src/server.cpp +++ b/src/server.cpp @@ -1088,8 +1088,6 @@ void CServer::CreateAndSendChanListForAllConChannels() if ( vecChannels[i].IsConnected() ) { // send message -// #### COMPATIBILITY OLD VERSION, TO BE REMOVED #### -vecChannels[i].CreateConClientListNameMes ( vecChanInfo ); vecChannels[i].CreateConClientListMes ( vecChanInfo ); } } @@ -1107,8 +1105,6 @@ void CServer::CreateAndSendChanListForThisChan ( const int iCurChanID ) CVector vecChanInfo ( CreateChannelList() ); // now send connected channels list to the channel with the ID "iCurChanID" -// #### COMPATIBILITY OLD VERSION, TO BE REMOVED #### -vecChannels[iCurChanID].CreateConClientListNameMes ( vecChanInfo ); vecChannels[iCurChanID].CreateConClientListMes ( vecChanInfo ); } diff --git a/src/testbench.h b/src/testbench.h index 49bf645b..b3905f8d 100755 --- a/src/testbench.h +++ b/src/testbench.h @@ -122,14 +122,6 @@ public slots: GenRandomIntInRange ( -100, 100 ) ); break; - case 3: // PROTMESSID_CONN_CLIENTS_LIST_NAME - vecChanInfo[0].iChanID = GenRandomIntInRange ( -2, 20 ); - vecChanInfo[0].iIpAddr = GenRandomIntInRange ( 0, 100000 ); - vecChanInfo[0].strName = GenRandomString(); - - Protocol.CreateConClientListNameMes ( vecChanInfo ); - break; - case 4: // PROTMESSID_CONN_CLIENTS_LIST vecChanInfo[0].iChanID = GenRandomIntInRange ( -2, 20 ); vecChanInfo[0].iIpAddr = GenRandomIntInRange ( 0, 100000 ); @@ -142,10 +134,6 @@ public slots: Protocol.CreateReqConnClientsList(); break; - case 6: // PROTMESSID_CHANNEL_NAME - Protocol.CreateChanNameMes ( GenRandomString() ); - break; - case 7: // PROTMESSID_CHANNEL_INFOS ChannelCoreInfo.eCountry = static_cast ( GenRandomIntInRange ( 0, 100 ) ); diff --git a/src/util.h b/src/util.h index 5eb2c1fa..0c8f0982 100755 --- a/src/util.h +++ b/src/util.h @@ -796,7 +796,6 @@ class CChannelInfo : public CChannelCoreInfo { public: CChannelInfo() : - bOnlyNameIsUsed ( false ), iChanID ( 0 ), iIpAddr ( 0 ) {} @@ -804,7 +803,6 @@ public: const quint32 NiIP, const CChannelCoreInfo& NCorInf ) : CChannelCoreInfo ( NCorInf ), - bOnlyNameIsUsed ( false ), iChanID ( NiID ), iIpAddr ( NiIP ) {} @@ -820,7 +818,6 @@ public: NsCity, NiInstrument, NeSkillLevel ), - bOnlyNameIsUsed ( false ), iChanID ( NiID ), iIpAddr ( NiIP ) {} @@ -843,25 +840,6 @@ public: } } - -// #### COMPATIBILITY OLD VERSION, TO BE REMOVED #### -CChannelInfo ( const int NiID, - const quint32 NiIP, - const QString NsName ) : - CChannelCoreInfo ( NsName, - QLocale::AnyCountry, - "", - CInstPictures::GetNotUsedInstrument(), - SL_NOT_SET ), - bOnlyNameIsUsed ( true ), - iChanID ( NiID ), - iIpAddr ( NiIP ) {} - -// in old versions, the name was the only client info -> to be removed -// when compatiblility to old versions is removed -bool bOnlyNameIsUsed; - - // ID of the channel int iChanID;