void vortex_connection_set_data_full ( VortexConnection connection,
char *  key,
axlPointer  value,
axlDestroyFunc  key_destroy,
axlDestroyFunc  value_destroy 
)

Allows to store user space data into the connection like vortex_connection_set_data does but configuring functions to be called once required to deallocate data stored.

While storing user defined data into the connection it could be necessary to also define destroy functions for the value stored and the key stored. This allows to not worry about to free those data (including the key) once the connection is dropped.

This function allows to store data into the given connection defining destroy functions for the key and the value stored, per item.

1 [...]
2 void destroy_data_1 (axlPointer data)
3 {
4  // perform a memory deallocation for data1
5 }
6 
7 void destroy_data_2 (axlPointer data)
8 {
9  // perform a memory deallocation for data2
10 }
11 [...]
12 // store data 1 providing a destroy value function
13 vortex_connection_set_data_full (connection, "some:data:1",
14  data_1, NULL, destroy_data_1);
15 
16 // store data 2 providing a destroy value function
17 vortex_connection_set_data_full (connection, "some:data:2",
18  data_2, NULL, destroy_data_2);
19 [...]
Parameters
connectionThe connection where the data will be stored.
keyThe unique string key value.
valueThe value to be stored associated to the given key.
key_destroyAn optional key destroy function used to destroy (deallocate) memory used by the key.
value_destroyAn optional value destroy function used to destroy (deallocate) memory used by the value.

References vortex_hash_remove(), and vortex_hash_replace_full().

Referenced by vortex_alive_enable_check(), vortex_connection_do_greetings_exchange(), vortex_connection_set_data(), vortex_external_connection_new(), vortex_external_listener_new(), vortex_sasl_set_propertie(), vortex_sasl_start_auth_sync(), vortex_tls_start_negotiation_sync(), vortex_websocket_listener_new(), and vortex_xml_rpc_create_channel_pool().