mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-02 11:23:41 +01:00
Networking: add timeout support for TCP connecting
This commit is contained in:
@@ -13,6 +13,8 @@ void ffPreparePublicIp(FFPublicIpOptions* options)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
state.timeout = options->timeout;
|
||||
|
||||
if (options->url.length == 0)
|
||||
status = ffNetworkingSendHttpRequest(&state, "ipinfo.io", "/json", NULL);
|
||||
else
|
||||
@@ -49,7 +51,7 @@ const char* ffDetectPublicIp(FFPublicIpOptions* options, FFPublicIpResult* resul
|
||||
return status;
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY response = ffStrbufCreateA(4096);
|
||||
const char* error = ffNetworkingRecvHttpResponse(&state, &response, options->timeout);
|
||||
const char* error = ffNetworkingRecvHttpResponse(&state, &response);
|
||||
if (error == NULL)
|
||||
ffStrbufSubstrAfterFirstS(&response, "\r\n\r\n");
|
||||
else
|
||||
|
||||
@@ -12,6 +12,8 @@ void ffPrepareWeather(FFWeatherOptions* options)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
state.timeout = options->timeout;
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreateS("/");
|
||||
if (options->location.length)
|
||||
ffStrbufAppend(&path, &options->location);
|
||||
@@ -29,7 +31,7 @@ const char* ffDetectWeather(FFWeatherOptions* options, FFstrbuf* result)
|
||||
return status;
|
||||
|
||||
ffStrbufEnsureFree(result, 4095);
|
||||
const char* error = ffNetworkingRecvHttpResponse(&state, result, options->timeout);
|
||||
const char* error = ffNetworkingRecvHttpResponse(&state, result);
|
||||
if (error == NULL)
|
||||
{
|
||||
ffStrbufSubstrAfterFirstS(result, "\r\n\r\n");
|
||||
|
||||
Reference in New Issue
Block a user