Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Turn on TCP_NODELAY by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyg committed Jul 2, 2010
1 parent 7478207 commit d2fb070
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions librabbitmq/amqp_socket.c
Expand Up @@ -65,6 +65,7 @@
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>

#include <assert.h>

Expand All @@ -89,6 +90,15 @@ int amqp_open_socket(char const *hostname,
return -errno;
}

{
int one = 1;
if (setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one)) < 0) {
int result = -errno;
close(sockfd);
return result;
}
}

if (connect(sockfd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
int result = -errno;
close(sockfd);
Expand Down

0 comments on commit d2fb070

Please sign in to comment.