cgmnlm

Unnamed repository; edit this file 'description' to name the repository.
git clone git://code.clttr.info/cgmnlm.git
Log | Files | Refs | README | LICENSE

commit 2261437727f4e142424856f93bcd4c485c5e64d7
parent e8da1ed7a88c05e28f6cb790d9a2cb80fe79879f
Author: René Wagner <rwa@clttr.info>
Date:   Wed, 10 Nov 2021 19:40:16 +0100

introduce a connection timeout of ~15 seconds

closes #18

Diffstat:
Msrc/client.c | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/client.c b/src/client.c @@ -12,6 +12,7 @@ #include <gmni/gmni.h> #include <gmni/tofu.h> #include <gmni/url.h> +#include <netinet/tcp.h> static enum gemini_result gemini_get_addrinfo(struct Curl_URL *uri, struct gemini_options *options, @@ -69,6 +70,8 @@ gemini_connect(struct Curl_URL *uri, struct gemini_options *options, if (*sfd == -1) { continue; } + int synRetries = 3; + setsockopt(*sfd, IPPROTO_TCP, TCP_SYNCNT, &synRetries, sizeof(synRetries)); if (connect(*sfd, rp->ai_addr, rp->ai_addrlen) != -1) { break; }