cpw.malu.xmpp.jingle_ft: 768ae34d: Offer transport replace when failing to ...
malu at pidgin.im
malu at pidgin.im
Thu Jan 14 15:25:26 EST 2010
-----------------------------------------------------------------
Revision: 768ae34d8749980d7c74ee729fb47c3e5f394e6a
Ancestor: f633398d6092cef1bd49df2b3d21270d365d685a
Author: malu at pidgin.im
Date: 2010-01-14T20:21:04
Branch: im.pidgin.cpw.malu.xmpp.jingle_ft
URL: http://d.pidgin.im/viewmtn/revision/info/768ae34d8749980d7c74ee729fb47c3e5f394e6a
Modified files:
libpurple/protocols/jabber/jingle/file-transfer.c
libpurple/protocols/jabber/jingle/s5b.c
libpurple/protocols/jabber/jingle/s5b.h
ChangeLog:
Offer transport replace when failing to connect to the proxy (as well as when the remote failed to
connect to our candidates).
Move some of the fallback logic to the S5B handler
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/file-transfer.c 7d8dd8010353517bde012dcf8e624d187865a463
+++ libpurple/protocols/jabber/jingle/file-transfer.c 47b3e289161aeb1e0c65b2a743398b58fb4cd703
@@ -29,7 +29,6 @@ struct _JingleFTPrivate {
struct _JingleFTPrivate {
PurpleXfer *xfer;
PurpleCircBuffer *ibb_buffer;
- gboolean remote_failed_s5b;
};
#define JINGLE_FT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
@@ -351,9 +350,12 @@ jingle_file_transfer_s5b_connect_failed_
/* the S5B transport has failed to connect */
PurpleXfer *xfer = JINGLE_FT_GET_PRIVATE(JINGLE_FT(content))->xfer;
JingleSession *session = jingle_content_get_session(content);
-
- if (JINGLE_FT(content)->priv->remote_failed_s5b &&
- jingle_session_is_initiator(session)) {
+ JingleTransport *transport = jingle_content_get_transport(content);
+
+ if (JINGLE_IS_S5B(transport) &&
+ (!jingle_s5b_has_accepted_candidate(JINGLE_S5B(transport))
+ || jingle_s5b_had_proxy_error(JINGLE_S5B(transport)))
+ && jingle_session_is_initiator(session)) {
/* if the other end supports IBB, offer a transport replace */
gchar *who = jingle_session_get_remote_jid(session);
JabberStream *js = jingle_session_get_js(session);
@@ -395,6 +397,7 @@ jingle_file_transfer_s5b_connect_failed_
g_free(who);
}
g_object_unref(session);
+ g_object_unref(transport);
}
@@ -778,15 +781,6 @@ jingle_file_transfer_handle_action_inter
/* we should check for "stream-host" error (in the case of S5B) and
offer a transport-replace with IBB */
if (xmltransport) {
- xmlnode *candidate_error =
- xmlnode_get_child(xmltransport, "candidate-error");
-
- if (candidate_error) {
- purple_debug_info("jingle-ft",
- "got a streamhost-error, remote couldn't connect\n");
- JINGLE_FT_GET_PRIVATE(JINGLE_FT(content))->
- remote_failed_s5b = TRUE;
- }
if (JINGLE_IS_S5B(transport)) {
jingle_s5b_handle_transport_info(JINGLE_S5B(transport),
session, xmltransport);
@@ -808,22 +802,14 @@ jingle_file_transfer_handle_action_inter
purple_debug_info("jingle-ft",
"got transport-accept transport %p\n", transport);
- /* if we got a streamhost-error before, we should switch over to
- IBB here */
- if (JINGLE_FT(content)->priv->remote_failed_s5b) {
- /* Note: the new tranport are automatically accepted from
- pending before this is called */
- /* open the file, etc... */
- JINGLE_FT(content)->priv->ibb_buffer =
- purple_circ_buffer_new(jingle_ibb_get_block_size(
- JINGLE_IBB(transport)));
+ JINGLE_FT(content)->priv->ibb_buffer =
+ purple_circ_buffer_new(jingle_ibb_get_block_size(JINGLE_IBB(transport)));
- purple_xfer_set_write_fnc(xfer, jingle_file_transfer_ibb_write);
+ purple_xfer_set_write_fnc(xfer, jingle_file_transfer_ibb_write);
- /* send first data */
- purple_xfer_start(xfer, -1, NULL, 0);
- purple_xfer_prpl_ready(xfer);
- }
+ /* send first data */
+ purple_xfer_start(xfer, -1, NULL, 0);
+ purple_xfer_prpl_ready(xfer);
g_object_unref(session);
g_object_unref(transport);
============================================================
--- libpurple/protocols/jabber/jingle/s5b.c 9b22fc047eeaf7ce4cf8165ed0a264470b0891f7
+++ libpurple/protocols/jabber/jingle/s5b.c d7ed373b83c53d11de99c0630436ebafba4417c0
@@ -219,6 +219,7 @@ struct _JingleS5BPrivate {
JingleContent *failed_content; /* used for the failed callback */
gboolean is_connected_to_remote;
gboolean is_remote_connected;
+ gboolean had_proxy_error;
};
#define JINGLE_S5B_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), JINGLE_TYPE_S5B, JingleS5BPrivate))
@@ -1300,6 +1301,7 @@ jingle_s5b_send_proxy_error(gpointer dat
JingleS5B *s5b = ((JingleS5BConnectData *) data)->s5b;
JabberIq *proxy_error = jingle_s5b_create_proxy_error(session, s5b);
+ s5b->priv->had_proxy_error = TRUE;
jabber_iq_set_callback(proxy_error, jingle_s5b_proxy_error_cb, data);
jabber_iq_send(proxy_error);
}
@@ -1605,3 +1607,16 @@ jingle_s5b_is_connected(const JingleS5B
{
return s5b->priv->fd != -1;
}
+
+gboolean
+jingle_s5b_has_accepted_candidate(const JingleS5B *s5b)
+{
+ return s5b->priv->accepted_candidate != NULL;
+}
+
+gboolean
+jingle_s5b_had_proxy_error(const JingleS5B *s5b)
+{
+ return s5b->priv->had_proxy_error;
+}
+
============================================================
--- libpurple/protocols/jabber/jingle/s5b.h 1f9c9a497784d3488dcbc9c57710cb768a6153ff
+++ libpurple/protocols/jabber/jingle/s5b.h 1386bcb805aa08c3d41fea1ff547305b7b772655
@@ -98,7 +98,11 @@ gboolean jingle_s5b_is_connected(const J
void jingle_s5b_stop_connection_attempts(JingleS5B *s5b);
gboolean jingle_s5b_is_connected(const JingleS5B *s5b);
-
+
+gboolean jingle_s5b_has_accepted_candidate(const JingleS5B *s5b);
+
+gboolean jingle_s5b_had_proxy_error(const JingleS5B *s5b);
+
#ifdef __cplusplus
}
#endif
More information about the Commits
mailing list