{
SilcClientInternalConnectContext *ctx;
SilcClientConnection conn;
+ int sock;
SILC_LOG_DEBUG(("Connecting to port %d of server %s",
port, host));
ctx->tries = 0;
/* Do the actual connecting process */
- return silc_client_connect_to_server_internal(ctx);
+ sock = silc_client_connect_to_server_internal(ctx);
+ if (sock == -1)
+ silc_client_del_connection(client, conn);
+ return sock;
}
/* Start of the connection to the remote server. This is called after
/* Notify application of failure */
client->ops->connect(client, conn, FALSE);
+ silc_client_del_connection(client, conn);
}
return;
}
/* If connection is disconnecting already we will finally
close the connection */
if (SILC_IS_DISCONNECTING(sock)) {
- silc_client_close_connection(client, sock);
client->ops->disconnect(client, conn);
+ silc_client_close_connection(client, sock);
return;
}
client->ops->say(client, conn, "Connection closed: premature EOF");
SILC_LOG_DEBUG(("Premature EOF from connection %d", sock->sock));
- silc_client_close_connection(client, sock);
client->ops->disconnect(client, conn);
+ silc_client_close_connection(client, sock);
return;
}
conn->local_id_data = NULL;
conn->remote_host = NULL;
conn->current_channel = NULL;
+
+ silc_client_del_connection(client, conn);
}
if (sock->protocol) {