Browse Source

Fix crashes related to dispatching messages from netcode

The dispatcher may or may not be ready when these things happen. If it
isn't... KABOOOOOOOOM
Adam Johnson 10 years ago
parent
commit
f075496888
  1. 1
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientCommInterface.cpp
  2. 22
      Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp
  3. 1
      Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h

1
Sources/Plasma/PubUtilLib/plNetClient/plNetClientCommInterface.cpp

@ -65,6 +65,7 @@ int plNetClientCommMsgHandler::HandleMessage( plNetMessage* msg )
int plNetClientMgr::IInitNetClientComm()
{
NetCommActivatePostInitErrorHandler();
NetCommActivateMsgDispatchers();
ASSERT(!GetFlagsBit(kNetClientCommInited));
fNetClientComm.SetDefaultHandler(&fNetClientCommMsgHandler);

22
Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp

@ -741,10 +741,6 @@ void NetCommStartup () {
NetClientInitialize();
NetClientSetErrorHandler(IPreInitNetErrorCallback);
NetCliGameSetRecvBufferHandler(INetBufferCallback);
// NetCliAuthSetRecvBufferHandler(INetBufferCallback);
NetCliAuthSetNotifyNewBuildHandler(INotifyNewBuildCallback);
NetCliAuthSetConnectCallback(INotifyAuthConnectedCallback);
// Set startup age info
memset(&s_startupAge, 0, sizeof(s_startupAge));
@ -780,15 +776,10 @@ void NetCommEnableNet (
bool enabled,
bool wait
) {
if (enabled) {
if (enabled)
NetClientInitialize();
NetClientSetErrorHandler(INetErrorCallback);
NetCliGameSetRecvBufferHandler(INetBufferCallback);
// NetCliAuthSetRecvBufferHandler(INetBufferCallback);
}
else {
else
NetClientDestroy(wait);
}
}
//============================================================================
@ -796,6 +787,15 @@ void NetCommActivatePostInitErrorHandler () {
NetClientSetErrorHandler(INetErrorCallback);
}
//============================================================================
void NetCommActivateMsgDispatchers() {
NetClientSetErrorHandler(INetErrorCallback);
NetCliGameSetRecvBufferHandler(INetBufferCallback);
// NetCliAuthSetRecvBufferHandler(INetBufferCallback);
NetCliAuthSetNotifyNewBuildHandler(INotifyNewBuildCallback);
NetCliAuthSetConnectCallback(INotifyAuthConnectedCallback);
}
//============================================================================
void NetCommUpdate () {
// plClient likes to recursively call us on occasion; debounce that crap.

1
Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h

@ -136,6 +136,7 @@ void NetCommEnableNet (
bool wait
);
void NetCommActivatePostInitErrorHandler();
void NetCommActivateMsgDispatchers();
/*****************************************************************************

Loading…
Cancel
Save