[Telepathy-commits] [telepathy-gabble/master] factor out send_data
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Mon Mar 9 09:21:05 PDT 2009
---
src/bytestream-ibb.c | 46 ++++++++++++++++++++++++++++++----------------
1 files changed, 30 insertions(+), 16 deletions(-)
diff --git a/src/bytestream-ibb.c b/src/bytestream-ibb.c
index 1f86f56..bd51716 100644
--- a/src/bytestream-ibb.c
+++ b/src/bytestream-ibb.c
@@ -64,6 +64,10 @@ enum
#define READ_BUFFER_MAX_SIZE (512 * 1024)
+/* the number of not acked stanzas allowed. Once this number reached, we stop
+ * sending and wait for acks. */
+#define WINDOW_SIZE 10
+
struct _GabbleBytestreamIBBPrivate
{
GabbleConnection *conn;
@@ -323,29 +327,16 @@ gabble_bytestream_ibb_class_init (
param_spec);
}
-/*
- * gabble_bytestream_ibb_send
- *
- * Implements gabble_bytestream_iface_send on GabbleBytestreamIface
- */
static gboolean
-gabble_bytestream_ibb_send (GabbleBytestreamIface *iface,
- guint len,
- const gchar *str)
+send_data (GabbleBytestreamIBB *self,
+ const gchar *str,
+ guint len)
{
- GabbleBytestreamIBB *self = GABBLE_BYTESTREAM_IBB (iface);
GabbleBytestreamIBBPrivate *priv = GABBLE_BYTESTREAM_IBB_GET_PRIVATE (self);
LmMessage *iq;
guint sent, stanza_count;
LmMessageNode *data;
- if (priv->state != GABBLE_BYTESTREAM_STATE_OPEN)
- {
- DEBUG ("can't send data through a not open bytestream (state: %d)",
- priv->state);
- return FALSE;
- }
-
iq = lm_message_build (priv->peer_jid, LM_MESSAGE_TYPE_IQ,
'@', "type", "set",
'(', "data", "",
@@ -410,6 +401,29 @@ gabble_bytestream_ibb_send (GabbleBytestreamIface *iface,
return TRUE;
}
+/*
+ * gabble_bytestream_ibb_send
+ *
+ * Implements gabble_bytestream_iface_send on GabbleBytestreamIface
+ */
+static gboolean
+gabble_bytestream_ibb_send (GabbleBytestreamIface *iface,
+ guint len,
+ const gchar *str)
+{
+ GabbleBytestreamIBB *self = GABBLE_BYTESTREAM_IBB (iface);
+ GabbleBytestreamIBBPrivate *priv = GABBLE_BYTESTREAM_IBB_GET_PRIVATE (self);
+
+ if (priv->state != GABBLE_BYTESTREAM_STATE_OPEN)
+ {
+ DEBUG ("can't send data through a not open bytestream (state: %d)",
+ priv->state);
+ return FALSE;
+ }
+
+ return send_data (self, str, len);;
+}
+
void
gabble_bytestream_ibb_receive (GabbleBytestreamIBB *self,
LmMessage *msg,
--
1.5.6.5
More information about the telepathy-commits
mailing list