mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
rfbsrc: Check for connection being closed
Although it's not very well documented, g_input_stream_read_all() will set the number of bytes read to 0 if the connection is closed rather then returning an error.
This commit is contained in:
parent
0eb5722af6
commit
89f3f162a5
1 changed files with 8 additions and 1 deletions
|
@ -188,6 +188,7 @@ rfb_decoder_read (RfbDecoder * decoder, guint32 len)
|
|||
{
|
||||
GInputStream *in;
|
||||
GError *err = NULL;
|
||||
gsize count = 0;
|
||||
|
||||
if (!decoder->connection)
|
||||
return FALSE;
|
||||
|
@ -204,10 +205,16 @@ rfb_decoder_read (RfbDecoder * decoder, guint32 len)
|
|||
decoder->data_len = len;
|
||||
}
|
||||
|
||||
if (!g_input_stream_read_all (in, decoder->data, len, NULL,
|
||||
if (!g_input_stream_read_all (in, decoder->data, len, &count,
|
||||
decoder->cancellable, &err))
|
||||
goto recv_error;
|
||||
|
||||
if (count == 0) {
|
||||
g_set_error_literal (&err, G_IO_ERROR, G_IO_ERROR_BROKEN_PIPE,
|
||||
"Connection was closed.");
|
||||
goto recv_error;
|
||||
}
|
||||
|
||||
return decoder->data;
|
||||
|
||||
recv_error:
|
||||
|
|
Loading…
Reference in a new issue