Skip to content

Commit 3607fe1

Browse files
committed
Fixed another bug in sending packets
1 parent ee10978 commit 3607fe1

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

doc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5744,7 +5744,7 @@ void CMUSHclientDoc::SendPacket (const char * lpBuf, const int nBufLen)
57445744
if (m_bDebugIncomingPackets)
57455745
Debug_Packets ("Sent ", lpBuf, nBufLen, m_iOutputPacketCount);
57465746

5747-
m_pSocket->m_outstanding_data += CString (lpBuf, nBufLen);
5747+
m_pSocket->m_outstanding_data.append (lpBuf, nBufLen);
57485748

57495749
m_pSocket->OnSend (0); // in case FD_WRITE message got lost, try to send again
57505750

worldsock.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,24 @@ int count;
4343
return;
4444

4545
// if we have outstanding data to send, do it
46-
47-
if (m_outstanding_data.GetLength () <= 0)
46+
if (m_outstanding_data.empty ())
4847
return;
4948

50-
count = Send ((LPCTSTR) m_outstanding_data, m_outstanding_data.GetLength ());
49+
count = Send (m_outstanding_data.data (), m_outstanding_data.length ());
5150

5251
if (count != SOCKET_ERROR)
5352
m_pDoc->m_nBytesOut += count; // count bytes out
5453

5554
if (count > 0) // good send - do rest later
56-
m_outstanding_data = m_outstanding_data.Mid (count);
55+
m_outstanding_data.erase (0, count);
5756
else
5857
{
5958
int nError = GetLastError ();
6059
if (count == SOCKET_ERROR && nError != WSAEWOULDBLOCK)
6160
{
6261
ShutDownSocket (*this);
6362
// m_pSocket->OnClose (nError); // ????
64-
m_outstanding_data.Empty ();
63+
m_outstanding_data.erase ();
6564

6665
} // end of an error other than "would block"
6766
} // end of an error

worldsock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class CWorldSocket : public CAsyncSocket
2626
// Operations
2727
public:
2828
CMUSHclientDoc* m_pDoc;
29-
CString m_outstanding_data;
29+
string m_outstanding_data;
3030

3131
// Implementation
3232

0 commit comments

Comments
 (0)