rename dial to edial, reset timeout values before setsockopt - gopherproxy-c - … | |
git clone git://git.codemadness.org/gopherproxy-c | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 42c1f9f2c86049e667c4037b241bb04492cd36c7 | |
parent 4e8119f7c820b0898e1c07b41dabe1b8c72318f8 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Wed, 15 May 2019 19:05:25 +0200 | |
rename dial to edial, reset timeout values before setsockopt | |
Diffstat: | |
M gopherproxy.c | 16 +++++++++------- | |
1 file changed, 9 insertions(+), 7 deletions(-) | |
--- | |
diff --git a/gopherproxy.c b/gopherproxy.c | |
@@ -85,15 +85,12 @@ xmlencode(const char *s) | |
} | |
int | |
-dial(const char *host, const char *port) | |
+edial(const char *host, const char *port) | |
{ | |
struct addrinfo hints, *res, *res0; | |
int error, save_errno, s; | |
const char *cause = NULL; | |
- struct timeval timeout = { | |
- .tv_sec = MAX_RESPONSETIMEOUT, | |
- .tv_usec = 0, | |
- }; | |
+ struct timeval timeout; | |
memset(&hints, 0, sizeof(hints)); | |
hints.ai_family = AF_UNSPEC; | |
@@ -110,8 +107,13 @@ dial(const char *host, const char *port) | |
continue; | |
} | |
+ timeout.tv_sec = MAX_RESPONSETIMEOUT; | |
+ timeout.tv_usec = 0; | |
if (setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(ti… | |
die(500, "%s: setsockopt: %s\n", __func__, strerror(er… | |
+ | |
+ timeout.tv_sec = MAX_RESPONSETIMEOUT; | |
+ timeout.tv_usec = 0; | |
if (setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(ti… | |
die(500, "%s: setsockopt: %s\n", __func__, strerror(er… | |
@@ -180,7 +182,7 @@ servefile(const char *server, const char *port, const char … | |
int r, w, fd; | |
size_t totalsiz = 0; | |
- fd = dial(server, port); | |
+ fd = edial(server, port); | |
if (pledge("stdio", NULL) == -1) | |
die(500, "pledge: %s\n", strerror(errno)); | |
@@ -214,7 +216,7 @@ servedir(const char *server, const char *port, const char *… | |
ssize_t n; | |
int fd, r, i, len; | |
- fd = dial(server, port); | |
+ fd = edial(server, port); | |
if (pledge("stdio", NULL) == -1) | |
die(500, "pledge: %s\n", strerror(errno)); |