# HG changeset patch # User Senko Rasic # Date 1194451265 -3600 # Node ID e7ceb196a57339fc5cb6ed6c77b97e8ffd5e1f31 # Parent ac545b623d433fb4138fbe02db079b4cc08e0da8 Don't require StartTLS after it's already been started. diff -r ac545b623d43 -r e7ceb196a573 loudmouth/lm-connection.c --- a/loudmouth/lm-connection.c Tue Nov 06 12:31:33 2007 +0100 +++ b/loudmouth/lm-connection.c Wed Nov 07 17:01:05 2007 +0100 @@ -78,6 +78,7 @@ gchar *resource; LmMessageHandler *features_cb; LmMessageHandler *starttls_cb; + gboolean tls_started; /* Communication */ guint open_id; @@ -994,6 +995,7 @@ { if (lm_socket_starttls (connection->socket)) { connection_send_stream_header (connection); + connection->tls_started = TRUE; } else { connection_do_close (connection); connection_signal_disconnect (connection, @@ -1028,7 +1030,8 @@ lm_message_unref (msg); return LM_HANDLER_RESULT_REMOVE_MESSAGE; - } else if (lm_ssl_get_require_starttls (connection->ssl)) { + } else if (!connection->tls_started && + lm_ssl_get_require_starttls (connection->ssl)) { /* If there were no starttls features present and we require it, this is * the place to scream. */ @@ -1124,6 +1127,7 @@ connection->keep_alive_rate = 0; connection->socket = NULL; connection->use_xmpp = FALSE; + connection->tls_started = FALSE; connection->id_handlers = g_hash_table_new_full (g_str_hash, g_str_equal,