xrdp: check term event for more responsive shutdown

This commit is contained in:
Jay Sorg 2019-03-31 21:54:09 -07:00 committed by jsorg71
parent 06042dcff7
commit 0ed82f71e8
2 changed files with 26 additions and 4 deletions

View File

@ -712,13 +712,21 @@ trans_connect(struct trans *self, const char *server, const char *port,
now = g_time3(); now = g_time3();
if (now - start_time < timeout) if (now - start_time < timeout)
{ {
g_sleep(timeout / 5); g_sleep(100);
} }
else else
{ {
self->status = TRANS_STATUS_DOWN; self->status = TRANS_STATUS_DOWN;
return 1; return 1;
} }
if (self->is_term != NULL)
{
if (self->is_term())
{
self->status = TRANS_STATUS_DOWN;
return 1;
}
}
} }
} }
} }
@ -748,13 +756,21 @@ trans_connect(struct trans *self, const char *server, const char *port,
now = g_time3(); now = g_time3();
if (now - start_time < timeout) if (now - start_time < timeout)
{ {
g_sleep(timeout / 5); g_sleep(100);
} }
else else
{ {
self->status = TRANS_STATUS_DOWN; self->status = TRANS_STATUS_DOWN;
return 1; return 1;
} }
if (self->is_term != NULL)
{
if (self->is_term())
{
self->status = TRANS_STATUS_DOWN;
return 1;
}
}
} }
} }
} }

View File

@ -1440,7 +1440,10 @@ xrdp_mm_connect_chansrv(struct xrdp_mm *self, const char *ip, const char *port)
self->chan_trans_up = 1; self->chan_trans_up = 1;
break; break;
} }
if (g_is_term())
{
break;
}
g_sleep(1000); g_sleep(1000);
log_message(LOG_LEVEL_ERROR,"xrdp_mm_connect_chansrv: connect failed " log_message(LOG_LEVEL_ERROR,"xrdp_mm_connect_chansrv: connect failed "
"trying again..."); "trying again...");
@ -2275,7 +2278,10 @@ xrdp_mm_connect(struct xrdp_mm *self)
ok = 1; ok = 1;
break; break;
} }
if (g_is_term())
{
break;
}
g_sleep(1000); g_sleep(1000);
g_writeln("xrdp_mm_connect: connect failed " g_writeln("xrdp_mm_connect: connect failed "
"trying again..."); "trying again...");