firstcontact: add a 10s connect timeout

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2021-08-18 10:32:58 +02:00
parent ccc17c50a7
commit 82481e1694

View File

@@ -1,5 +1,6 @@
#define _GNU_SOURCE
#include <stdio.h>
#include <unistd.h>
#include <getopt.h>
#include <curl/curl.h>
@@ -20,6 +21,8 @@ int main(int argc, char **argv)
char *devid = NULL;
char *url;
alarm(15);
while (1) {
int option = getopt(argc, argv, "k:c:o:hi:");
@@ -85,6 +88,7 @@ int main(int argc, char **argv)
curl_easy_setopt(curl, CURLOPT_SSLKEYTYPE, "PEM");
curl_easy_setopt(curl, CURLOPT_SSLKEY, file_key);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1L);
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 10L);
res = curl_easy_perform(curl);
if (res != CURLE_OK)