[Telepathy-commits] [telepathy-gabble/master] Remove the close-on-connection-error crack

Marco Barisione marco at barisione.org
Tue Jan 6 08:41:32 PST 2009


---
 src/bytestream-ibb.c      |   13 ----------
 src/bytestream-iface.c    |    8 ------
 src/bytestream-multiple.c |   14 -----------
 src/bytestream-socks5.c   |   54 +++++++++++++++------------------------------
 4 files changed, 18 insertions(+), 71 deletions(-)

diff --git a/src/bytestream-ibb.c b/src/bytestream-ibb.c
index 0cbbcfd..c1f9d1a 100644
--- a/src/bytestream-ibb.c
+++ b/src/bytestream-ibb.c
@@ -70,7 +70,6 @@ enum
   PROP_PEER_RESOURCE,
   PROP_STATE,
   PROP_PROTOCOL,
-  PROP_CLOSE_ON_CONNECTION_ERROR,
   PROP_BLOCK_SIZE,
   LAST_PROPERTY
 };
@@ -84,7 +83,6 @@ struct _GabbleBytestreamIBBPrivate
   gchar *peer_resource;
   GabbleBytestreamState state;
   gchar *peer_jid;
-  gboolean close_on_connection_error;
   guint block_size;
 
   guint16 seq;
@@ -101,8 +99,6 @@ gabble_bytestream_ibb_init (GabbleBytestreamIBB *self)
       GABBLE_TYPE_BYTESTREAM_IBB, GabbleBytestreamIBBPrivate);
 
   self->priv = priv;
-
-  priv->close_on_connection_error = TRUE;
 }
 
 static void
@@ -180,9 +176,6 @@ gabble_bytestream_ibb_get_property (GObject *object,
       case PROP_PROTOCOL:
         g_value_set_string (value, NS_IBB);
         break;
-      case PROP_CLOSE_ON_CONNECTION_ERROR:
-        g_value_set_boolean (value, priv->close_on_connection_error);
-        break;
       case PROP_BLOCK_SIZE:
         g_value_set_uint (value, priv->block_size);
         break;
@@ -228,9 +221,6 @@ gabble_bytestream_ibb_set_property (GObject *object,
               g_signal_emit (object, signals[STATE_CHANGED], 0, priv->state);
             }
         break;
-      case PROP_CLOSE_ON_CONNECTION_ERROR:
-        priv->close_on_connection_error = g_value_get_boolean (value);
-        break;
       case PROP_BLOCK_SIZE:
         priv->block_size = g_value_get_uint (value);
         break;
@@ -305,9 +295,6 @@ gabble_bytestream_ibb_class_init (
        "state");
    g_object_class_override_property (object_class, PROP_PROTOCOL,
        "protocol");
-   g_object_class_override_property (object_class,
-       PROP_CLOSE_ON_CONNECTION_ERROR, "close-on-connection-error");
-
 
   param_spec = g_param_spec_string (
       "peer-resource",
diff --git a/src/bytestream-iface.c b/src/bytestream-iface.c
index c3c8aac..72e0381 100644
--- a/src/bytestream-iface.c
+++ b/src/bytestream-iface.c
@@ -132,14 +132,6 @@ gabble_bytestream_iface_base_init (gpointer klass)
           G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
       g_object_interface_install_property (klass, param_spec);
 
-      param_spec = g_param_spec_boolean (
-          "close-on-connection-error",
-          "Close on connection error",
-          "Wether to send a close stanza if there was a connection error",
-          TRUE,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-      g_object_interface_install_property (klass, param_spec);
-
       initialized = TRUE;
     }
 }
diff --git a/src/bytestream-multiple.c b/src/bytestream-multiple.c
index f67bb07..5cf635a 100644
--- a/src/bytestream-multiple.c
+++ b/src/bytestream-multiple.c
@@ -82,7 +82,6 @@ struct _GabbleBytestreamMultiplePrivate
   gchar *peer_resource;
   GabbleBytestreamState state;
   gchar *peer_jid;
-  gboolean close_on_connection_error;
   GabbleBytestreamFactory *factory;
 
   /* List of gchar* */
@@ -103,8 +102,6 @@ gabble_bytestream_multiple_init (GabbleBytestreamMultiple *self)
       GABBLE_TYPE_BYTESTREAM_MULTIPLE, GabbleBytestreamMultiplePrivate);
 
   self->priv = priv;
-
-  priv->close_on_connection_error = TRUE;
 }
 
 static void
@@ -185,9 +182,6 @@ gabble_bytestream_multiple_get_property (GObject *object,
       case PROP_PROTOCOL:
         g_value_set_string (value, NS_BYTESTREAMS);
         break;
-      case PROP_CLOSE_ON_CONNECTION_ERROR:
-        g_value_set_boolean (value, priv->close_on_connection_error);
-        break;
       case PROP_FACTORY:
         g_value_set_object (value, priv->factory);
         break;
@@ -233,9 +227,6 @@ gabble_bytestream_multiple_set_property (GObject *object,
             g_signal_emit (object, signals[STATE_CHANGED], 0, priv->state);
           }
         break;
-      case PROP_CLOSE_ON_CONNECTION_ERROR:
-        priv->close_on_connection_error = g_value_get_boolean (value);
-        break;
       case PROP_FACTORY:
         priv->factory = g_value_get_object (value);
         break;
@@ -554,11 +545,6 @@ bytestream_connection_error_cb (GabbleBytestreamIface *failed,
   if (priv->fallback_stream_methods == NULL)
     return;
 
-  /* If we have other methods to try, prevent the failed bytestream to send a
-     close stanza */
-  // XXX
-  //g_object_set (failed, "close-on-connection-error", FALSE, NULL);
-
   DEBUG ("Trying alternative streaming method");
 
   bytestream_activate_next (self);
diff --git a/src/bytestream-socks5.c b/src/bytestream-socks5.c
index 29549c2..1502e2a 100644
--- a/src/bytestream-socks5.c
+++ b/src/bytestream-socks5.c
@@ -85,7 +85,6 @@ enum
   PROP_PEER_RESOURCE,
   PROP_STATE,
   PROP_PROTOCOL,
-  PROP_CLOSE_ON_CONNECTION_ERROR,
   LAST_PROPERTY
 };
 
@@ -160,7 +159,6 @@ struct _GabbleBytestreamSocks5Private
   gchar *peer_resource;
   GabbleBytestreamState bytestream_state;
   gchar *peer_jid;
-  gboolean close_on_connection_error;
 
   /* List of Streamhost */
   GSList *streamhosts;
@@ -203,8 +201,6 @@ gabble_bytestream_socks5_init (GabbleBytestreamSocks5 *self)
       GABBLE_TYPE_BYTESTREAM_SOCKS5, GabbleBytestreamSocks5Private);
 
   self->priv = priv;
-
-  priv->close_on_connection_error = TRUE;
 }
 
 static void
@@ -288,9 +284,6 @@ gabble_bytestream_socks5_get_property (GObject *object,
       case PROP_PROTOCOL:
         g_value_set_string (value, NS_BYTESTREAMS);
         break;
-      case PROP_CLOSE_ON_CONNECTION_ERROR:
-        g_value_set_boolean (value, priv->close_on_connection_error);
-        break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
         break;
@@ -335,9 +328,6 @@ gabble_bytestream_socks5_set_property (GObject *object,
                   priv->bytestream_state);
             }
         break;
-      case PROP_CLOSE_ON_CONNECTION_ERROR:
-        priv->close_on_connection_error = g_value_get_boolean (value);
-        break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
         break;
@@ -411,8 +401,6 @@ gabble_bytestream_socks5_class_init (
        "state");
    g_object_class_override_property (object_class, PROP_PROTOCOL,
        "protocol");
-   g_object_class_override_property (object_class,
-       PROP_CLOSE_ON_CONNECTION_ERROR, "close-on-connection-error");
 
   param_spec = g_param_spec_string (
       "peer-resource",
@@ -567,13 +555,10 @@ socks5_error (GabbleBytestreamSocks5 *self)
 
       g_signal_emit (self, signals[CONNECTION_ERROR], 0);
 
-      if (priv->close_on_connection_error)
-        {
-          g_assert (priv->msg_for_acknowledge_connection != NULL);
-          _gabble_connection_send_iq_error (priv->conn,
-              priv->msg_for_acknowledge_connection, XMPP_ERROR_ITEM_NOT_FOUND,
-              "impossible to connect to any streamhost");
-        }
+      g_assert (priv->msg_for_acknowledge_connection != NULL);
+      _gabble_connection_send_iq_error (priv->conn,
+          priv->msg_for_acknowledge_connection, XMPP_ERROR_ITEM_NOT_FOUND,
+          "impossible to connect to any streamhost");
 
       lm_message_unref (priv->msg_for_acknowledge_connection);
       priv->msg_for_acknowledge_connection = NULL;
@@ -1180,7 +1165,6 @@ gabble_bytestream_socks5_decline (GabbleBytestreamSocks5 *self,
           "Offer Declined");
     }
 
-  /* FIXME: we should not send the SI error if we are falling back */
   _gabble_connection_send (priv->conn, msg, NULL);
 
   lm_message_unref (msg);
@@ -1212,28 +1196,25 @@ gabble_bytestream_socks5_close (GabbleBytestreamIface *iface,
     }
   else
     {
+      LmMessage *msg;
+
       DEBUG ("send Socks5 close stanza");
 
       socks5_close_channel (self);
 
-      if (priv->close_on_connection_error)
-        {
-          LmMessage *msg;
-
-          msg = lm_message_build (priv->peer_jid, LM_MESSAGE_TYPE_IQ,
-              '@', "type", "set",
-              '(', "close", "",
-                '@', "xmlns", NS_BYTESTREAMS,
-                '@', "sid", priv->stream_id,
-              ')', NULL);
+      msg = lm_message_build (priv->peer_jid, LM_MESSAGE_TYPE_IQ,
+          '@', "type", "set",
+          '(', "close", "",
+            '@', "xmlns", NS_BYTESTREAMS,
+            '@', "sid", priv->stream_id,
+          ')', NULL);
 
-          /* We don't really care about the answer as the bytestream
-           * is closed anyway. */
-          _gabble_connection_send_with_reply (priv->conn, msg,
-              NULL, NULL, NULL, NULL);
+      /* We don't really care about the answer as the bytestream
+       * is closed anyway. */
+      _gabble_connection_send_with_reply (priv->conn, msg,
+          NULL, NULL, NULL, NULL);
 
-          lm_message_unref (msg);
-        }
+      lm_message_unref (msg);
 
       g_object_set (self, "state", GABBLE_BYTESTREAM_STATE_CLOSED, NULL);
     }
@@ -1257,6 +1238,7 @@ socks5_init_reply_cb (GabbleConnection *conn,
   else
     {
       DEBUG ("error during Socks5 initiation");
+
       g_signal_emit (self, signals[CONNECTION_ERROR], 0);
       g_object_set (self, "state", GABBLE_BYTESTREAM_STATE_CLOSED, NULL);
     }
-- 
1.5.6.5




More information about the Telepathy-commits mailing list