File tree Expand file tree Collapse file tree 3 files changed +23
-11
lines changed Expand file tree Collapse file tree 3 files changed +23
-11
lines changed Original file line number Diff line number Diff line change @@ -1162,11 +1162,6 @@ CString str;
1162
1162
return TRUE ;
1163
1163
}
1164
1164
1165
- void CMUSHclientDoc::ProcessPendingRead ()
1166
- {
1167
- ReceiveMsg ();
1168
- }
1169
-
1170
1165
// SendMsg sends a message (command) to the MUD.
1171
1166
// If there is already a queue (for speedwalking etc.) it is placed
1172
1167
// at the end of the queue. The message is marked to indicate whether
@@ -1350,15 +1345,18 @@ CString str = strText;
1350
1345
1351
1346
}
1352
1347
1353
- void CMUSHclientDoc::ReceiveMsg ()
1348
+ void CMUSHclientDoc::ReceiveMsg (char * buff, int count )
1354
1349
{
1355
- char buff [1000 ]; // must be less than COMPRESS_BUFFER_LENGTH or it won't fit
1356
- int count = m_pSocket->Receive (buff, sizeof (buff) - 1 );
1357
1350
1358
1351
Frame.CheckTimerFallback (); // see if time is up for timers to fire
1359
1352
1360
1353
if (count == SOCKET_ERROR)
1361
1354
{
1355
+
1356
+ DWORD errcode = GetLastError ();
1357
+ if (errcode == WSAEWOULDBLOCK || errcode == 0 )
1358
+ return ; // it's ok, nothing to do
1359
+
1362
1360
// don't delete the socket if we are already closing it
1363
1361
if (m_iConnectPhase == eConnectDisconnecting)
1364
1362
return ;
Original file line number Diff line number Diff line change @@ -1399,15 +1399,14 @@ class CMUSHclientDoc : public CDocument
1399
1399
// Operations
1400
1400
public:
1401
1401
BOOL ConnectSocket (void );
1402
- void ProcessPendingRead ();
1403
1402
void DoSendMsg (const CString& strText,
1404
1403
const bool bEchoIt,
1405
1404
const bool bLogIt);
1406
1405
void SendMsg (CString strText,
1407
1406
const bool bEchoIt,
1408
1407
const bool bQueueIt,
1409
1408
const bool bLogIt);
1410
- void ReceiveMsg ();
1409
+ void ReceiveMsg (char * buff, int count );
1411
1410
void DisplayMsg (LPCTSTR lpszText, int size, const int flags);
1412
1411
void AddToLine (LPCTSTR lpszText, const int flags);
1413
1412
void StartNewLine_KeepPreviousStyle (const int flags);
Original file line number Diff line number Diff line change @@ -29,7 +29,22 @@ CWorldSocket::CWorldSocket(CMUSHclientDoc* pDoc)
29
29
30
30
void CWorldSocket::OnReceive (int nErrorCode)
31
31
{
32
- m_pDoc->ProcessPendingRead ();
32
+
33
+ char buff [1000 ]; // must be less than COMPRESS_BUFFER_LENGTH or it won't fit
34
+
35
+ while (true )
36
+ {
37
+ int count = m_pDoc->m_pSocket ->Receive (buff, sizeof (buff) - 1 );
38
+ m_pDoc->ReceiveMsg (buff, count);
39
+
40
+ if (count == 0 ) // connection closed or nothing left
41
+ break ;
42
+
43
+ if (count == SOCKET_ERROR)
44
+ break ; // some error or other
45
+
46
+ } // end of while
47
+
33
48
CAsyncSocket::OnReceive (nErrorCode);
34
49
}
35
50
You can’t perform that action at this time.
0 commit comments