sc->input_bytes->data + oldsize, READ_SIZE, sc->cancellable, &error);
g_byte_array_set_size (sc->input_bytes, oldsize + (ret > 0 ? ret : 0));
+ if (ret == 0) {
+ error = g_error_new (G_IO_ERROR, G_IO_ERROR_CONNECTION_CLOSED,
+ "connection closed remotely");
+ ret = -1;
+ }
+
if (ret < 0) {
gint code = error->code;
GST_ERROR_OBJECT (sc, "read error: %s %d %s",
g_quark_to_string (error->domain), code, error->message);
- g_error_free (error);
- } else if (ret == 0) {
- GST_INFO_OBJECT (sc, "read EOF");
- }
- if (ret <= 0) {
gst_rtmp_connection_emit_error (sc);
+ g_error_free (error);
return G_SOURCE_REMOVE;
}
static void
gst_rtmp_connection_emit_error (GstRtmpConnection * self)
{
- if (self->error) {
- return;
+ if (!self->error) {
+ self->error = TRUE;
+ cancel_all_commands (self);
+ g_signal_emit (self, signals[SIGNAL_ERROR], 0);
}
-
- GST_INFO_OBJECT (self, "connection error");
- self->error = TRUE;
-
- cancel_all_commands (self);
-
- g_signal_emit (self, signals[SIGNAL_ERROR], 0);
}
static void