TCP_NODELAY
This commit is contained in:
parent
1cce984784
commit
c8937f3f52
|
@ -11,6 +11,7 @@
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -56,6 +57,11 @@ static void accept_connection(int servfd, short what, void *arg) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int i = 1;
|
||||||
|
ICHECK(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &i, sizeof(i)), "setsockopt TCP_NODELAY");
|
||||||
|
}
|
||||||
|
|
||||||
start_relay(&s, fd);
|
start_relay(&s, fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -44,6 +45,11 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
if (connect(fd, (struct sockaddr *) &s, sizeof(s)) < 0) return 1;
|
if (connect(fd, (struct sockaddr *) &s, sizeof(s)) < 0) return 1;
|
||||||
|
|
||||||
|
{
|
||||||
|
int i = 1;
|
||||||
|
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &i, sizeof(i));
|
||||||
|
}
|
||||||
|
|
||||||
f = fdopen(fd, "a+");
|
f = fdopen(fd, "a+");
|
||||||
|
|
||||||
fprintf(f, "(9:subscribe5:test10:0:5:test15:login)(4:post7:factory(6:create5:queue(2:q1)5:test11:k)0:)(4:post2:q1(9:subscribe0:5:test18:consumer5:test11:k)0:)\n");
|
fprintf(f, "(9:subscribe5:test10:0:5:test15:login)(4:post7:factory(6:create5:queue(2:q1)5:test11:k)0:)(4:post2:q1(9:subscribe0:5:test18:consumer5:test11:k)0:)\n");
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -83,6 +84,11 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
if (connect(fd, (struct sockaddr *) &s, sizeof(s)) < 0) return 1;
|
if (connect(fd, (struct sockaddr *) &s, sizeof(s)) < 0) return 1;
|
||||||
|
|
||||||
|
{
|
||||||
|
int i = 1;
|
||||||
|
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &i, sizeof(i));
|
||||||
|
}
|
||||||
|
|
||||||
f = fdopen(fd, "a+");
|
f = fdopen(fd, "a+");
|
||||||
|
|
||||||
fprintf(f, "(9:subscribe5:test10:0:5:test15:login)(4:post7:factory(6:create5:queue(2:q1)5:test11:k)0:)(4:post2:q1(9:subscribe0:5:test18:consumer5:test11:k)0:)\n");
|
fprintf(f, "(9:subscribe5:test10:0:5:test15:login)(4:post7:factory(6:create5:queue(2:q1)5:test11:k)0:)(4:post2:q1(9:subscribe0:5:test18:consumer5:test11:k)0:)\n");
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -46,6 +47,11 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
if (connect(fd, (struct sockaddr *) &s, sizeof(s)) < 0) return 1;
|
if (connect(fd, (struct sockaddr *) &s, sizeof(s)) < 0) return 1;
|
||||||
|
|
||||||
|
{
|
||||||
|
int i = 1;
|
||||||
|
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &i, sizeof(i));
|
||||||
|
}
|
||||||
|
|
||||||
f = fdopen(fd, "a+");
|
f = fdopen(fd, "a+");
|
||||||
|
|
||||||
fprintf(f, "(9:subscribe5:test30:0:5:test35:login)");
|
fprintf(f, "(9:subscribe5:test30:0:5:test35:login)");
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -79,6 +80,11 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
if (connect(fd, (struct sockaddr *) &s, sizeof(s)) < 0) return 1;
|
if (connect(fd, (struct sockaddr *) &s, sizeof(s)) < 0) return 1;
|
||||||
|
|
||||||
|
{
|
||||||
|
int i = 1;
|
||||||
|
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &i, sizeof(i));
|
||||||
|
}
|
||||||
|
|
||||||
f = fdopen(fd, "a+");
|
f = fdopen(fd, "a+");
|
||||||
|
|
||||||
fprintf(f, "(9:subscribe5:test30:0:5:test35:login)");
|
fprintf(f, "(9:subscribe5:test30:0:5:test35:login)");
|
||||||
|
|
Loading…
Reference in New Issue