Skip to content

Commit

Permalink
try harder to log remote status (error) messages
Browse files Browse the repository at this point in the history
For example, if remote fails with "compiler did not start" and
client fails to send EndMsg(), still try to read the StatusTextMsg.
  • Loading branch information
llunak committed Mar 26, 2014
1 parent 02fcd24 commit 00feeaa
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions client/remote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ static UseCSMsg *get_server(MsgChannel *local_daemon)
static void check_for_failure(Msg *msg, MsgChannel *cserver)
{
if (msg && msg->type == M_STATUS_TEXT) {
log_error() << static_cast<StatusTextMsg*>(msg)->text << " - compiled on "
<< cserver->name << endl;
log_error() << "Remote status (compiled on " << cserver->name << "): "
<< static_cast<StatusTextMsg*>(msg)->text << endl;
throw(23);
}
}
Expand Down Expand Up @@ -579,6 +579,13 @@ static int build_remote_int(CompileJob &job, UseCSMsg *usecs, MsgChannel *local_
}

} catch (int x) {
// Handle pending status messages, if any.
while( Msg* msg = cserver->get_msg(0)) {
if(msg->type == M_STATUS_TEXT)
log_error() << "Remote status (compiled on " << cserver->name << "): "
<< static_cast<StatusTextMsg*>(msg)->text << endl;
delete msg;
}
delete cserver;
cserver = 0;
throw(x);
Expand Down

0 comments on commit 00feeaa

Please sign in to comment.