if (!engine)
return NULL;
- engine->contexts = silc_hash_table_alloc(0, silc_hash_ptr, NULL, NULL, NULL,
+ engine->contexts = silc_hash_table_alloc(NULL, 0, silc_hash_ptr,
+ NULL, NULL, NULL,
silc_packet_engine_context_destr,
engine, TRUE);
if (!engine->contexts) {
/* If this is UDP stream, allocate UDP remote stream hash table */
if (!engine->udp_remote && silc_socket_stream_is_udp(stream, NULL))
- engine->udp_remote = silc_hash_table_alloc(0, silc_hash_string, NULL,
- silc_hash_string_compare, NULL,
- silc_packet_engine_hash_destr,
- NULL, TRUE);
+ engine->udp_remote =
+ silc_hash_table_alloc(NULL, 0, silc_hash_string_case, NULL,
+ silc_hash_string_case_compare, NULL,
+ silc_packet_engine_hash_destr, NULL, TRUE);
silc_mutex_unlock(engine->lock);
SILC_LOG_HEXDUMP(("IV"), ret_iv, 8);
- /* Set new nonce to counter block */
+ /* Set new IV to counter block */
memcpy(iv + 4, ret_iv, 8);
} else {
/* Increment 64-bit packet counter */
SILC_LOG_HEXDUMP(("Counter Block"), iv, 16);
}
-/* Internal routine to assemble outgoing packet. Assembles and encryptes
+/* Internal routine to assemble outgoing packet. Assembles and encrypts
the packet. The silc_packet_stream_write needs to be called to send it
after this returns TRUE. */
silc_mutex_lock(stream->lock);
+ if (silc_unlikely(stream->destroyed)) {
+ SILC_LOG_DEBUG(("Stream %p is destroyed, cannot send packet", stream));
+ silc_mutex_unlock(stream->lock);
+ return FALSE;
+ }
+
/* Get packet pointer from the outgoing buffer */
if (silc_unlikely(!silc_packet_send_prepare(stream, truelen + padlen + ivlen
+ psnlen, hmac, &packet))) {