Fix Visual Studio related bugs

This commit is contained in:
Zhi Guan
2022-10-09 12:55:32 +08:00
parent dc58a88588
commit 6faeb627ed
16 changed files with 91 additions and 28 deletions

View File

@@ -47,7 +47,13 @@ int tls13_server_main(int argc , char **argv)
char buf[1600] = {0};
size_t len = sizeof(buf);
#ifdef WIN32
SOCKET sock;
SOCKET conn_sock;
#else
int sock;
int conn_sock;
#endif
struct sockaddr_in server_addr;
struct sockaddr_in client_addr;
#ifdef WIN32
@@ -55,7 +61,7 @@ int tls13_server_main(int argc , char **argv)
#else
socklen_t client_addrlen;
#endif
int conn_sock;
argc--;
@@ -181,7 +187,11 @@ restart:
if (tls13_send(&conn, (uint8_t *)buf, len, &sentlen) != 1) {
fprintf(stderr, "%s: send failure, close connection\n", prog);
#ifdef WIN32
closesocket(conn.sock);
#else
close(conn.sock);
#endif
goto end;
}
}