summaryrefslogtreecommitdiff
path: root/librabbitmq
diff options
context:
space:
mode:
authorKetan Kulkarni <ketkulka@gmail.com>2017-03-24 15:32:39 -0700
committerAlan Antonuk <alan.antonuk@gmail.com>2017-03-25 18:35:28 -0700
commit45ba6ed5fcfd84db532d8212f71854880ee36ca0 (patch)
tree61de79c38d606adf029e417375f32f2f2fe9c630 /librabbitmq
parent4a8744fc5874a6d09a72d87d11326f64317004f2 (diff)
downloadrabbitmq-c-45ba6ed5fcfd84db532d8212f71854880ee36ca0.tar.gz
TCP Keep alive for RabbitMQ Client
- Enable TCP Keep Alive for rabbitmq client - Helps in cases when the connection is conntracked or there is NAT in between
Diffstat (limited to 'librabbitmq')
-rw-r--r--librabbitmq/amqp_socket.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/librabbitmq/amqp_socket.c b/librabbitmq/amqp_socket.c
index a63a0b6..f4e536a 100644
--- a/librabbitmq/amqp_socket.c
+++ b/librabbitmq/amqp_socket.c
@@ -480,6 +480,12 @@ int amqp_open_socket_inner(char const *hostname,
continue;
}
+ if (0 != amqp_os_socket_setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &one,
+ sizeof(one))) {
+ last_error = AMQP_STATUS_SOCKET_ERROR;
+ continue;
+ }
+
#ifdef _WIN32
res = connect(sockfd, addr->ai_addr, (int)addr->ai_addrlen);
#else