History

9gc: disable Nagle

Sigrid Solveig Haflínudóttir committed 4 years ago

Commit dafd86d1 parent c5c3a281 file · +6 −2Browse files

Unified · Split

9gc.c+6−2
@@ -3,6 +3,7 @@ · 2 unmodified lines
33 #include <errno.h>
44 #include <netdb.h>
55 #include <netinet/in.h>
6+#include <netinet/tcp.h>
67 #include <stdarg.h>
78 #include <stdio.h>
89 #include <stdlib.h>
@@ -117,7 +118,7 @@ dial(char *s) · 108 unmodified lines
117118 {
118119 struct addrinfo *r, *a, hint = {.ai_flags = AI_ADDRCONFIG, .ai_family = AF_UNSPEC, 0};
119120 char host[64], *port;
120− int e, f;
121+ int e, f, yes;
121122
122123 if (strncmp(s, "udp!", 4) == 0) {
123124 hint.ai_socktype = SOCK_DGRAM;
@@ -143,11 +144,14 @@ dial(char *s) · 19 unmodified lines
143144 return -1;
144145 }
145146 f = -1;
147+ yes = 1;
146148 for (a = r; a != NULL; a = a->ai_next) {
147149 if ((f = socket(a->ai_family, a->ai_socktype, a->ai_protocol)) < 0)
148150 continue;
149− if (connect(f, a->ai_addr, a->ai_addrlen) == 0)
151+ if (connect(f, a->ai_addr, a->ai_addrlen) == 0) {
152+ setsockopt(f, SOL_TCP, TCP_NODELAY, &yes, sizeof(yes));
150153 break;
154+ }
151155 close(f);
152156 f = -1;
153157 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t