diff --git a/src/channel.cpp b/src/channel.cpp index 6bd4d845cf..53f91766a8 100644 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -526,7 +526,7 @@ void CChannel::PutProtocolData ( const int iRecCounter, const int iRecID, const } } -EPutDataStat CChannel::PutAudioData ( const CVector& vecbyData, const int iNumBytes, CHostAddress RecHostAddr ) +EPutDataStat CChannel::PutAudioData ( const CVector& vecbyData, const int iNumBytes, const CHostAddress& RecHostAddr ) { // init return state EPutDataStat eRet = PS_GEN_ERROR; diff --git a/src/channel.h b/src/channel.h index cbfbb1eef6..9f70bfee6f 100644 --- a/src/channel.h +++ b/src/channel.h @@ -70,7 +70,7 @@ class CChannel : public QObject void PutProtocolData ( const int iRecCounter, const int iRecID, const CVector& vecbyMesBodyData, const CHostAddress& RecHostAddr ); - EPutDataStat PutAudioData ( const CVector& vecbyData, const int iNumBytes, CHostAddress RecHostAddr ); + EPutDataStat PutAudioData ( const CVector& vecbyData, const int iNumBytes, const CHostAddress& RecHostAddr ); EGetDataStat GetData ( CVector& vecbyData, const int iNumBytes ); @@ -83,7 +83,7 @@ class CChannel : public QObject void SetEnable ( const bool bNEnStat ); bool IsEnabled() { return bIsEnabled; } - void SetAddress ( const CHostAddress NAddr ) { InetAddr = NAddr; } + void SetAddress ( const CHostAddress& NAddr ) { InetAddr = NAddr; } const CHostAddress& GetAddress() const { return InetAddr; } void ResetInfo() diff --git a/src/recorder/jamrecorder.cpp b/src/recorder/jamrecorder.cpp index 91f30fe2a5..50669c4a3f 100644 --- a/src/recorder/jamrecorder.cpp +++ b/src/recorder/jamrecorder.cpp @@ -41,7 +41,7 @@ using namespace recorder; * Creates a file for the raw PCM data and sets up a QDataStream to which to write received frames. * The data is stored Little Endian. */ -CJamClient::CJamClient ( const qint64 frame, const int _numChannels, const QString name, const CHostAddress address, const QDir recordBaseDir ) : +CJamClient::CJamClient ( const qint64 frame, const int _numChannels, const QString name, const CHostAddress& address, const QDir recordBaseDir ) : startFrame ( frame ), numChannels ( static_cast ( _numChannels ) ), name ( name ), diff --git a/src/recorder/jamrecorder.h b/src/recorder/jamrecorder.h index cc6db1970f..1ff181deb4 100644 --- a/src/recorder/jamrecorder.h +++ b/src/recorder/jamrecorder.h @@ -74,7 +74,7 @@ class CJamClient : public QObject Q_OBJECT public: - CJamClient ( const qint64 frame, const int numChannels, const QString name, const CHostAddress address, const QDir recordBaseDir ); + CJamClient ( const qint64 frame, const int numChannels, const QString name, const CHostAddress& address, const QDir recordBaseDir ); void Frame ( const QString name, const CVector& pcm, int iServerFrameSizeSamples ); diff --git a/src/serverlist.cpp b/src/serverlist.cpp index 412278cacd..59d2362bd1 100644 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -727,7 +727,7 @@ void CServerListManager::RetrieveAll ( const CHostAddress& InetAddr ) } } -int CServerListManager::IndexOf ( CHostAddress haSearchTerm ) +int CServerListManager::IndexOf ( const CHostAddress& haSearchTerm ) { // Called with lock set. diff --git a/src/serverlist.h b/src/serverlist.h index 8c5729f940..8e48ae1fbc 100644 --- a/src/serverlist.h +++ b/src/serverlist.h @@ -181,7 +181,7 @@ class CServerListManager : public QObject void Register(); void SetRegistered ( bool bIsRegister ); - int IndexOf ( CHostAddress haSearchTerm ); + int IndexOf ( const CHostAddress& haSearchTerm ); bool Load(); void Save(); void SetSvrRegStatus ( ESvrRegStatus eNSvrRegStatus ); diff --git a/src/socket.cpp b/src/socket.cpp index 911e6d97a4..b9052933f8 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -365,6 +365,8 @@ void CSocket::OnDataReceived() use the signal/slot mechanism (i.e. we use messages for that). */ + CHostAddress RecHostAddr; + // read block from network interface and query address of sender uSockAddr UdpSocketAddr; #ifdef _WIN32 @@ -381,6 +383,7 @@ void CSocket::OnDataReceived() return; } + // convert address of client if ( UdpSocketAddr.sa.sa_family == AF_INET6 ) { if ( IN6_IS_ADDR_V4MAPPED ( &( UdpSocketAddr.sa6.sin6_addr ) ) ) @@ -396,7 +399,6 @@ void CSocket::OnDataReceived() } else { - // convert address of client RecHostAddr.InetAddr.setAddress ( ntohl ( UdpSocketAddr.sa4.sin_addr.s_addr ) ); RecHostAddr.iPort = ntohs ( UdpSocketAddr.sa4.sin_port ); } diff --git a/src/socket.h b/src/socket.h index b2ea19b19c..51708c049c 100644 --- a/src/socket.h +++ b/src/socket.h @@ -78,9 +78,6 @@ class CSocket : public QObject QMutex Mutex; CVector vecbyRecBuf; - CHostAddress RecHostAddr; - QHostAddress SenderAddress; - quint16 SenderPort; CChannel* pChannel; // for client CServer* pServer; // for server diff --git a/src/util.h b/src/util.h index 23b76fb473..66c70294ee 100644 --- a/src/util.h +++ b/src/util.h @@ -747,7 +747,7 @@ class CHostAddress CHostAddress() : InetAddr ( static_cast ( 0 ) ), iPort ( 0 ) {} - CHostAddress ( const QHostAddress NInetAddr, const quint16 iNPort ) : InetAddr ( NInetAddr ), iPort ( iNPort ) {} + CHostAddress ( const QHostAddress& NInetAddr, const quint16 iNPort ) : InetAddr ( NInetAddr ), iPort ( iNPort ) {} CHostAddress ( const CHostAddress& NHAddr ) : InetAddr ( NHAddr.InetAddr ), iPort ( NHAddr.iPort ) {}