summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
9b290d7)
Take a reference of the packet stream and then destroy it. The final
reference is freed in the timeout callback. Any operation in the mean
time will detect the stream is destroyed and won't do anything.
SILC_CONNTYPE_STRING(idata->conn_type),
silc_packet_error_string(error)));
SILC_CONNTYPE_STRING(idata->conn_type),
silc_packet_error_string(error)));
+ if (!silc_packet_stream_is_valid(stream))
+ return;
+
silc_schedule_task_add_timeout(server->schedule,
silc_server_packet_error_timeout,
stream, 0, 0);
silc_schedule_task_add_timeout(server->schedule,
silc_server_packet_error_timeout,
stream, 0, 0);
SILC_TASK_CALLBACK(silc_server_close_connection_final)
{
SILC_TASK_CALLBACK(silc_server_close_connection_final)
{
- silc_packet_stream_destroy(context);
+ silc_packet_stream_unref(context);
}
/* Closes connection to socket connection */
}
/* Closes connection to socket connection */
const char *hostname;
SilcUInt16 port;
const char *hostname;
SilcUInt16 port;
+ if (!silc_packet_stream_is_valid(sock))
+ return;
+
memset(tmp, 0, sizeof(tmp));
// silc_socket_get_error(sock, tmp, sizeof(tmp));
silc_socket_stream_get_info(silc_packet_stream_get_stream(sock),
memset(tmp, 0, sizeof(tmp));
// silc_socket_get_error(sock, tmp, sizeof(tmp));
silc_socket_stream_get_info(silc_packet_stream_get_stream(sock),
+ /* Take a reference and then destroy the stream. The last reference
+ is released later in a timeout callback. */
+ silc_packet_stream_ref(sock);
+ silc_packet_stream_destroy(sock);
+
/* Close connection with timeout */
server->stat.conn_num--;
silc_schedule_task_del_by_all(server->schedule, 0,
/* Close connection with timeout */
server->stat.conn_num--;
silc_schedule_task_del_by_all(server->schedule, 0,