Networking (Linux): remove unnecessary variables

This commit is contained in:
Carter Li
2025-03-18 09:51:11 +08:00
parent dbc5a7961e
commit 28bc97b92b
2 changed files with 2 additions and 7 deletions
-1
View File
@@ -15,7 +15,6 @@ typedef struct FFNetworkingState {
OVERLAPPED overlapped;
#else
int sockfd;
FFstrbuf host;
FFstrbuf command;
struct addrinfo* addr;
+2 -6
View File
@@ -24,7 +24,7 @@ static const char* tryTcpFastOpen(FFNetworkingState* state)
FF_UNUSED(state);
return "TCP Fast Open not supported";
#else
FF_DEBUG("Attempting to use TCP Fast Open to connect to %s", state->host.chars);
FF_DEBUG("Attempting to use TCP Fast Open to connect");
#ifndef __APPLE__ // On macOS, TCP_FASTOPEN doesn't seem to be needed
// Set TCP Fast Open
@@ -97,7 +97,6 @@ static const char* tryTcpFastOpen(FFNetworkingState* state)
sent, errno, strerror(errno));
freeaddrinfo(state->addr);
state->addr = NULL;
ffStrbufDestroy(&state->host);
ffStrbufDestroy(&state->command);
return NULL;
}
@@ -124,7 +123,7 @@ static const char* tryTcpFastOpen(FFNetworkingState* state)
static const char* connectAndSend(FFNetworkingState* state)
{
const char* ret = NULL;
FF_DEBUG("Using traditional connection method to connect to %s", state->host.chars);
FF_DEBUG("Using traditional connection method to connect");
FF_DEBUG("Attempting connect() to server...");
if(connect(state->sockfd, state->addr->ai_addr, state->addr->ai_addrlen) == -1)
@@ -155,7 +154,6 @@ exit:
FF_DEBUG("Releasing address info and other resources");
freeaddrinfo(state->addr);
state->addr = NULL;
ffStrbufDestroy(&state->host);
ffStrbufDestroy(&state->command);
return ret;
@@ -169,8 +167,6 @@ static const char* initNetworkingState(FFNetworkingState* state, const char* hos
FF_DEBUG("Initializing network connection state: host=%s, path=%s", host, path);
// Initialize command and host information
ffStrbufInitS(&state->host, host);
ffStrbufInitA(&state->command, 64);
ffStrbufAppendS(&state->command, "GET ");
ffStrbufAppendS(&state->command, path);