summaryrefslogtreecommitdiff
path: root/src/bytestream-multiple.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bytestream-multiple.c')
-rw-r--r--src/bytestream-multiple.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/bytestream-multiple.c b/src/bytestream-multiple.c
index 331077353..753e4877b 100644
--- a/src/bytestream-multiple.c
+++ b/src/bytestream-multiple.c
@@ -77,6 +77,7 @@ struct _GabbleBytestreamMultiplePrivate
/* List of (gchar *) containing the NS of a stream method */
GList *fallback_stream_methods;
GabbleBytestreamIface *active_bytestream;
+ gboolean read_blocked;
gboolean dispose_has_run;
};
@@ -584,6 +585,10 @@ bytestream_activate_next (GabbleBytestreamMultiple *self)
g_free (stream_method);
+ /* block the new bytestream if needed */
+ gabble_bytestream_iface_block_reading (priv->active_bytestream,
+ priv->read_blocked);
+
g_signal_connect (priv->active_bytestream, "connection-error",
G_CALLBACK (bytestream_connection_error_cb), self);
g_signal_connect (priv->active_bytestream, "data-received",
@@ -632,6 +637,23 @@ gabble_bytestream_multiple_has_stream_method (GabbleBytestreamMultiple *self)
}
static void
+gabble_bytestream_multiple_block_reading (GabbleBytestreamIface *iface,
+ gboolean block)
+{
+ GabbleBytestreamMultiple *self = GABBLE_BYTESTREAM_MULTIPLE (iface);
+ GabbleBytestreamMultiplePrivate *priv =
+ GABBLE_BYTESTREAM_MULTIPLE_GET_PRIVATE (self);
+
+ if (priv->read_blocked == block)
+ return;
+
+ priv->read_blocked = block;
+
+ g_assert (priv->active_bytestream != NULL);
+ gabble_bytestream_iface_block_reading (priv->active_bytestream, block);
+}
+
+static void
bytestream_iface_init (gpointer g_iface,
gpointer iface_data)
{
@@ -641,4 +663,5 @@ bytestream_iface_init (gpointer g_iface,
klass->send = gabble_bytestream_multiple_send;
klass->close = gabble_bytestream_multiple_close;
klass->accept = gabble_bytestream_multiple_accept;
+ klass->block_reading = gabble_bytestream_multiple_block_reading;
}