From 463cb2d7ddb68f27b7626175e2ca6e213dab6b1f Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Sat, 24 Apr 2010 21:33:33 +0300 Subject: [PATCH] core cleanup: remove current_service & ssl_connect_failure callbacks Remove buggy global variable current_service. We have to find another way to implement its functionality if it is really needed (which I doubt). This removes the need for the SSL connect failure callbacks, which have been removed. --- src/api/sipe-core.h | 4 --- src/core/http-conn.c | 6 ----- src/core/sip-transport.c | 62 +++++-------------------------------------- src/purple/purple-transport.c | 6 ----- 4 files changed, 7 insertions(+), 71 deletions(-) diff --git a/src/api/sipe-core.h b/src/api/sipe-core.h index b051af23..bcf32f60 100644 --- a/src/api/sipe-core.h +++ b/src/api/sipe-core.h @@ -216,12 +216,8 @@ void sipe_core_transport_sip_connect(struct sipe_core_public *sipe_public, const gchar *port); void sipe_core_transport_sip_connected(struct sipe_transport_connection *conn); void sipe_core_transport_sip_message(struct sipe_transport_connection *conn); -void sipe_core_transport_sip_ssl_connect_failure(struct sipe_transport_connection *conn, - const gchar *msg); void sipe_core_transport_http_connected(struct sipe_transport_connection *conn); void sipe_core_transport_http_message(struct sipe_transport_connection *conn); -void sipe_core_transport_http_ssl_connect_failure(struct sipe_transport_connection *conn, - const gchar *msg); void sipe_core_transport_http_input_error(struct sipe_transport_connection *conn, const gchar *msg); diff --git a/src/core/http-conn.c b/src/core/http-conn.c index dcdd43be..52beee7b 100644 --- a/src/core/http-conn.c +++ b/src/core/http-conn.c @@ -247,12 +247,6 @@ static void http_conn_transport_error(HttpConn *http_conn, const gchar *msg) http_conn_close(http_conn, msg); } -void sipe_core_transport_http_ssl_connect_failure(struct sipe_transport_connection *conn, - const char *msg) -{ - http_conn_transport_error(HTTP_CONN, msg); -} - void sipe_core_transport_http_input_error(struct sipe_transport_connection *conn, const gchar *msg) { diff --git a/src/core/sip-transport.c b/src/core/sip-transport.c index 60a5f028..bdd48779 100644 --- a/src/core/sip-transport.c +++ b/src/core/sip-transport.c @@ -580,40 +580,6 @@ struct sipe_service_data { guint type; }; -/** - * NOTE: This is BROKEN. Don't ask me to explain why it is in here, I didn't - * implement it... - * - * This is a global variable, i.e. it affects all SIPE accounts configured - * for server auto-discovery & SIPE_TRANSPORT_AUTO. - * - * - Only one active account: - * * if TLS connect fails this will make sure TLS is skipped in the next - * attempt (OK) - * * when the account disconnects then the next attempt will *NOT* start - * with the successful entry, but the next one (BROKEN) - * - * - More than one active account: - * * when a new account connects then the attempt will *NOT* start with - * successful one, but the next one (BROKEN) - * - * IMHO this should be removed. - */ -static const struct sipe_service_data *current_service = NULL; - -void sipe_core_transport_sip_ssl_connect_failure(struct sipe_transport_connection *conn, - SIPE_UNUSED_PARAMETER const gchar *msg) -{ - struct sipe_core_private *sipe_private = conn->user_data; - - current_service = sipe_private->service_data; - if (current_service) { - SIPE_DEBUG_INFO("current_service: transport '%s' protocol '%s'", - current_service->transport ? current_service->transport : "NULL", - current_service->protocol ? current_service->protocol : "NULL"); - } -} - void sipe_core_transport_sip_connected(struct sipe_transport_connection *conn) { struct sipe_core_private *sipe_private = conn->user_data; @@ -643,6 +609,12 @@ static const struct sipe_service_data service_tcp[] = { { NULL, NULL, 0 } }; +static const struct sipe_service_data *services[] = { + service_autodetect, /* SIPE_TRANSPORT_AUTO */ + service_tls, /* SIPE_TRANSPORT_TLS */ + service_tcp /* SIPE_TRANSPORT_TCP */ +}; + static void resolve_next_service(struct sipe_core_private *sipe_private, const struct sipe_service_data *start) { @@ -712,27 +684,7 @@ void sipe_core_transport_sip_connect(struct sipe_core_public *sipe_public, /* Remember user specified transport type */ sipe_private->transport_type = transport; - - switch (transport) { - case SIPE_TRANSPORT_AUTO: - if (current_service && - current_service->protocol != NULL && - current_service->transport != NULL) { - current_service++; - resolve_next_service(sipe_private, - current_service); - } else { - resolve_next_service(sipe_private, - service_autodetect); - } - break; - case SIPE_TRANSPORT_TLS: - resolve_next_service(sipe_private, service_tls); - break; - case SIPE_TRANSPORT_TCP: - resolve_next_service(sipe_private, service_tcp); - break; - } + resolve_next_service(sipe_private, services[transport]); } } diff --git a/src/purple/purple-transport.c b/src/purple/purple-transport.c index 8ff6c97d..a157b24d 100644 --- a/src/purple/purple-transport.c +++ b/src/purple/purple-transport.c @@ -69,8 +69,6 @@ struct transport_hooks /* can be NULL */ gboolean (*ssl_check)(struct sipe_transport_purple *transport, const gchar *msg); - void (*ssl_connect_failure)(struct sipe_transport_connection *conn, - const gchar *msg); gboolean (*connected_check)(struct sipe_transport_purple *transport, PurpleSslConnection *gsc, int fd); @@ -155,8 +153,6 @@ static void transport_ssl_connect_failure(SIPE_UNUSED_PARAMETER PurpleSslConnect transport->hooks->ssl_check(transport, msg)) return; - transport->hooks->ssl_connect_failure(SIPE_TRANSPORT_CONNECTION, msg); - transport->socket = -1; transport->gsc = NULL; } @@ -428,7 +424,6 @@ static const struct transport_hooks transport_sip_hooks = { transport_sip_input_error, sipe_core_transport_sip_message, transport_sip_ssl_check, - sipe_core_transport_sip_ssl_connect_failure, transport_sip_connected_check, transport_sip_input_ssl, transport_sip_input_tcp, @@ -513,7 +508,6 @@ static const struct transport_hooks transport_http_hooks = { transport_http_input_error, sipe_core_transport_http_message, NULL, - sipe_core_transport_http_ssl_connect_failure, transport_http_connected_check, transport_http_input_ssl, transport_http_input_tcp, -- 2.11.4.GIT