Disable Nagle's Algorithm by adding TCP_NODELAY option to the socket

Signed-off-by: Gennady Feldman <gena01@gmail.com>
v1.1
Yarek Tyshchenko 2014-05-01 17:48:07 +01:00 committed by Gennady Feldman
parent beb86e70fe
commit 214d0eb602
1 changed files with 3 additions and 0 deletions

View File

@ -27,6 +27,7 @@
#include "ext/standard/php_smart_str.h"
#include "stomp.h"
#include "php_stomp.h"
#include <netinet/tcp.h>
#define RETURN_READ_FRAME_FAIL { stomp_free_frame(f); return NULL; }
@ -174,6 +175,8 @@ int stomp_connect(stomp_t *stomp, const char *host, unsigned short port TSRMLS_D
stomp_set_error(stomp, error, errno, NULL);
return 0;
}
int flag = 1;
setsockopt(stomp->fd, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int));
size = sizeof(stomp->localaddr);
memset(&stomp->localaddr, 0, size);