Browse Source

tpws: use accept4 instead of accept

pull/148/head
bol-van 2 years ago
parent
commit
d5b104d781
  1. BIN
      binaries/aarch64/tpws
  2. BIN
      binaries/arm/tpws
  3. BIN
      binaries/freebsd-x64/tpws
  4. BIN
      binaries/mac64/tpws
  5. BIN
      binaries/mips32r1-lsb/tpws
  6. BIN
      binaries/mips32r1-msb/tpws
  7. BIN
      binaries/mips64r2-msb/tpws
  8. BIN
      binaries/ppc/tpws
  9. BIN
      binaries/x86/tpws
  10. BIN
      binaries/x86_64/tpws
  11. BIN
      binaries/x86_64/tpws_wsl.tgz
  12. 7
      tpws/tpws_conn.c

BIN
binaries/aarch64/tpws

Binary file not shown.

BIN
binaries/arm/tpws

Binary file not shown.

BIN
binaries/freebsd-x64/tpws

Binary file not shown.

BIN
binaries/mac64/tpws

Binary file not shown.

BIN
binaries/mips32r1-lsb/tpws

Binary file not shown.

BIN
binaries/mips32r1-msb/tpws

Binary file not shown.

BIN
binaries/mips64r2-msb/tpws

Binary file not shown.

BIN
binaries/ppc/tpws

Binary file not shown.

BIN
binaries/x86/tpws

Binary file not shown.

BIN
binaries/x86_64/tpws

Binary file not shown.

BIN
binaries/x86_64/tpws_wsl.tgz

Binary file not shown.

7
tpws/tpws_conn.c

@ -1200,7 +1200,12 @@ int event_loop(const int *listen_fd, size_t listen_fd_ct)
accept_salen = sizeof(accept_sa); accept_salen = sizeof(accept_sa);
//Accept new connection //Accept new connection
#if defined (__APPLE__)
// macos does not have accept4()
tmp_fd = accept(conn->fd, (struct sockaddr*)&accept_sa, &accept_salen); tmp_fd = accept(conn->fd, (struct sockaddr*)&accept_sa, &accept_salen);
#else
tmp_fd = accept4(conn->fd, (struct sockaddr*)&accept_sa, &accept_salen, SOCK_NONBLOCK);
#endif
if (tmp_fd < 0) if (tmp_fd < 0)
{ {
perror("Failed to accept connection"); perror("Failed to accept connection");
@ -1210,12 +1215,14 @@ int event_loop(const int *listen_fd, size_t listen_fd_ct)
close(tmp_fd); close(tmp_fd);
VPRINT("Too many local legs : %d", legs_local) VPRINT("Too many local legs : %d", legs_local)
} }
#if defined (__APPLE__)
// separate fcntl call to comply with macos // separate fcntl call to comply with macos
else if (fcntl(tmp_fd, F_SETFL, O_NONBLOCK) < 0) else if (fcntl(tmp_fd, F_SETFL, O_NONBLOCK) < 0)
{ {
perror("socket set O_NONBLOCK (accept)"); perror("socket set O_NONBLOCK (accept)");
close(tmp_fd); close(tmp_fd);
} }
#endif
else if (!(conn=add_tcp_connection(efd, &conn_list, tmp_fd, (struct sockaddr*)&accept_sa, params.port, params.proxy_type))) else if (!(conn=add_tcp_connection(efd, &conn_list, tmp_fd, (struct sockaddr*)&accept_sa, params.port, params.proxy_type)))
{ {
// add_tcp_connection closes fd in case of failure // add_tcp_connection closes fd in case of failure

Loading…
Cancel
Save