Skip to content

Commit e369e97

Browse files
committed
Make CTcpConnection members private
1 parent a1d0c91 commit e369e97

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ void CServer::OnSendCLProtMessage ( CHostAddress InetAddr, CVector<uint8_t> vecM
488488
if ( pTcpConnection )
489489
{
490490
// send to the connected socket directly
491-
pTcpConnection->pTcpSocket->write ( (const char*) &( (CVector<uint8_t>) vecMessage )[0], vecMessage.Size() );
491+
pTcpConnection->write ( (const char*) &( (CVector<uint8_t>) vecMessage )[0], vecMessage.Size() );
492492
}
493493
else
494494
{

src/tcpconnection.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,13 @@ void CTcpConnection::OnReadyRead()
143143

144144
qDebug() << "- end of readyRead(), bytesAvailable() =" << pTcpSocket->bytesAvailable();
145145
}
146+
147+
qint64 CTcpConnection::write ( const char* data, qint64 maxSize )
148+
{
149+
if ( !pTcpSocket )
150+
{
151+
return -1;
152+
}
153+
154+
return pTcpSocket->write ( data, maxSize );
155+
}

src/tcpconnection.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ class CTcpConnection : public QObject
4949
CTcpConnection ( QTcpSocket* pTcpSocket, const CHostAddress& tcpAddress, CServer* pServer = nullptr );
5050
~CTcpConnection() {}
5151

52+
qint64 write ( const char* data, qint64 maxSize );
53+
54+
private:
5255
QTcpSocket* pTcpSocket;
5356
CHostAddress tcpAddress;
5457
CHostAddress udpAddress;
5558

56-
private:
5759
CServer* pServer;
5860
int iPos;
5961
int iPayloadRemain;

0 commit comments

Comments
 (0)