Don't keep fetching messages if the remote server has disconnected

This commit is contained in:
baldurk
2018-12-19 10:45:07 +00:00
parent 9ac07f806b
commit 96b881dbd7
3 changed files with 16 additions and 3 deletions
+13 -3
View File
@@ -1635,18 +1635,28 @@ void MainWindow::messageCheck()
}
m_Ctx.Replay().AsyncInvoke([this](IReplayController *r) {
rdcarray<DebugMessage> msgs = r->GetDebugMessages();
rdcarray<DebugMessage> msgs;
bool disconnected = false;
if(m_Ctx.Replay().CurrentRemote())
{
bool prev = m_Ctx.Replay().CurrentRemote()->serverRunning;
bool wasRunning = m_Ctx.Replay().CurrentRemote()->serverRunning;
m_Ctx.Replay().PingRemote();
if(prev != m_Ctx.Replay().CurrentRemote()->serverRunning)
if(wasRunning != m_Ctx.Replay().CurrentRemote()->serverRunning)
{
qCritical() << "Remote server disconnected";
disconnected = true;
}
if(!disconnected && wasRunning)
msgs = r->GetDebugMessages();
}
else
{
msgs = r->GetDebugMessages();
}
GUIInvoke::call(this, [this, disconnected, msgs] {
+1
View File
@@ -2519,6 +2519,7 @@ bool ReplayProxy::CheckError(ReplayProxyPacket receivedPacket, ReplayProxyPacket
if(m_Writer.IsErrored() || m_Reader.IsErrored() || m_IsErrored)
{
RDCERR("Error during processing of %s", ToStr(expectedPacket).c_str());
m_IsErrored = true;
return true;
}
+2
View File
@@ -39,6 +39,8 @@ static std::string wsaerr_string(int err)
{
switch(err)
{
case WSAENOTSOCK:
return "WSAENOTSOCK: An operation was attempted on something that is not a socket";
case WSAEWOULDBLOCK:
return "WSAEWOULDBLOCK: A non-blocking socket operation could not be completed immediately";
case WSAEADDRINUSE: