mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-26 04:27:25 +00:00
Merge pull request #1456 in FS/freeswitch from ~PRAVEEN_KUMAR/freeswitch:bugfix/FS-10833-mod_amqp-memory-leak-on-reconnection to master
* commit 'd311a06a8318d74dddee1ec2bbaed9d949da9cea': FS-10833: [mod_amqp] memory leak on reconnection attempt to RabbitMQ broker
This commit is contained in:
commit
edbff5dfd2
@ -109,7 +109,7 @@ switch_status_t mod_amqp_connection_open(mod_amqp_connection_t *connections, mod
|
|||||||
|
|
||||||
if (!(socket = amqp_tcp_socket_new(newConnection))) {
|
if (!(socket = amqp_tcp_socket_new(newConnection))) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not create TCP socket\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not create TCP socket\n");
|
||||||
return SWITCH_STATUS_GENERR;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
connection_attempt = connections;
|
connection_attempt = connections;
|
||||||
@ -130,7 +130,7 @@ switch_status_t mod_amqp_connection_open(mod_amqp_connection_t *connections, mod
|
|||||||
|
|
||||||
if (!connection_attempt) {
|
if (!connection_attempt) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Profile[%s] could not connect to any AMQP brokers\n", profile_name);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Profile[%s] could not connect to any AMQP brokers\n", profile_name);
|
||||||
return SWITCH_STATUS_GENERR;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Profile[%s] opened socket connection to AMQP broker %s:%d\n",
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Profile[%s] opened socket connection to AMQP broker %s:%d\n",
|
||||||
@ -150,13 +150,15 @@ switch_status_t mod_amqp_connection_open(mod_amqp_connection_t *connections, mod
|
|||||||
if (mod_amqp_log_if_amqp_error(status, "Logging in")) {
|
if (mod_amqp_log_if_amqp_error(status, "Logging in")) {
|
||||||
mod_amqp_connection_close(*active);
|
mod_amqp_connection_close(*active);
|
||||||
*active = NULL;
|
*active = NULL;
|
||||||
return SWITCH_STATUS_GENERR;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open a channel (1). This is fairly standard
|
// Open a channel (1). This is fairly standard
|
||||||
amqp_channel_open(newConnection, 1);
|
amqp_channel_open(newConnection, 1);
|
||||||
if (mod_amqp_log_if_amqp_error(amqp_get_rpc_reply(newConnection), "Opening channel")) {
|
if (mod_amqp_log_if_amqp_error(amqp_get_rpc_reply(newConnection), "Opening channel")) {
|
||||||
return SWITCH_STATUS_GENERR;
|
mod_amqp_connection_close(*active);
|
||||||
|
*active = NULL;
|
||||||
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*active)->state = newConnection;
|
(*active)->state = newConnection;
|
||||||
@ -166,6 +168,12 @@ switch_status_t mod_amqp_connection_open(mod_amqp_connection_t *connections, mod
|
|||||||
}
|
}
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
|
||||||
|
err:
|
||||||
|
if (newConnection) {
|
||||||
|
amqp_destroy_connection(newConnection);
|
||||||
|
}
|
||||||
|
return SWITCH_STATUS_GENERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_status_t mod_amqp_connection_create(mod_amqp_connection_t **conn, switch_xml_t cfg, switch_memory_pool_t *pool)
|
switch_status_t mod_amqp_connection_create(mod_amqp_connection_t **conn, switch_xml_t cfg, switch_memory_pool_t *pool)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user