{
RemoteClient *client = data;
RemoteConnection *rc;
+ GIOStatus status = G_IO_STATUS_NORMAL;
rc = client->rc;
GError *error = NULL;
guint termpos;
- while (g_io_channel_read_line(source, &buffer, NULL, &termpos, &error) == G_IO_STATUS_NORMAL)
+ while ((status = g_io_channel_read_line(source, &buffer, NULL, &termpos, &error)) == G_IO_STATUS_NORMAL)
{
if (buffer)
{
g_list_free(queue);
}
- if (condition & G_IO_HUP)
+ if (condition & G_IO_HUP || status == G_IO_STATUS_EOF || status == G_IO_STATUS_ERROR)
{
rc->clients = g_list_remove(rc->clients, client);