1
0
mirror of https://github.com/bol-van/zapret.git synced 2025-05-12 16:52:59 +03:00

Compare commits

...

2 Commits

Author SHA1 Message Date
bol-van
d8ed978566 tpws: emergency connection close on failed shutdown() 2024-08-28 11:07:33 +03:00
bol-van
006dc2fb33 bsd docs: pfsense more edit to enable freebsd repos 2024-08-28 09:54:59 +03:00
13 changed files with 25 additions and 8 deletions
binaries
aarch64
arm
freebsd-x64
mac64
mips32r1-lsb
mips32r1-msb
mips64r2-msb
ppc
x86
x86_64
docs
tpws

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -226,8 +226,8 @@ systems. In this case run `dvtws` as `/opt/zapret/nfq/dvtws`. Or just copy
present. It's possible to renew lists.
If you dont like poverty of default repos its possible to enable FreeBSD repo.
Change `no` to `yes` in `/usr/local/etc/pkg/repos/FreeBSD.conf`. Then it
becomes possible to install all the required software including git to download
Change `no` to `yes` in `/usr/local/etc/pkg/repos/FreeBSD.conf` and `/usr/local/etc/pkg/repos/pfSense.conf`.
Then it becomes possible to install all the required software including git to download
zapret from github directly.

@ -260,11 +260,15 @@ static bool conn_has_unsent_pair(tproxy_conn_t *conn)
return conn_has_unsent(conn) || (conn_partner_alive(conn) && conn_has_unsent(conn->partner));
}
static void conn_shutdown(tproxy_conn_t *conn)
static bool conn_shutdown(tproxy_conn_t *conn)
{
if (shutdown(conn->fd,SHUT_WR)<0)
DLOG_PERROR("shutdown");
conn->bShutdown = true;
if (shutdown(conn->fd,SHUT_WR)<0)
{
DLOG_PERROR("shutdown");
return false;
}
return true;
}
static ssize_t send_or_buffer(send_buffer_t *sb, int fd, const void *buf, size_t len, int flags, int ttl)
@ -761,7 +765,11 @@ static bool handle_unsent(tproxy_conn_t *conn)
if (!conn->bShutdown)
{
DBGPRINT("fd=%d no more has unsent. partner in RDHUP state. executing delayed shutdown.\n", conn->fd);
conn_shutdown(conn);
if (!conn_shutdown(conn))
{
DBGPRINT("emergency connection close due to failed shutdown\n");
return false;
}
}
if (conn->state==CONN_RDHUP && !conn_has_unsent(conn->partner))
{
@ -1606,7 +1614,11 @@ int event_loop(const int *listen_fd, size_t listen_fd_ct)
else
{
DBGPRINT("partner has no unsent. shutting down partner.\n");
conn_shutdown(conn->partner);
if (!conn_shutdown(conn->partner))
{
DBGPRINT("emergency connection close due to failed shutdown\n");
conn_close_with_partner_check(&conn_list,&close_list,conn);
}
if (conn->partner->state==CONN_RDHUP)
{
DBGPRINT("both partners are in RDHUP state and have no unsent. closing.\n");
@ -1644,7 +1656,12 @@ int event_loop(const int *listen_fd, size_t listen_fd_ct)
if ((conn->state == CONN_RDHUP) && conn_partner_alive(conn) && !conn->partner->bShutdown && !conn_has_unsent(conn))
{
DBGPRINT("conn fd=%d has no unsent. shutting down partner.\n", conn->fd);
conn_shutdown(conn->partner);
if (!conn_shutdown(conn->partner))
{
DBGPRINT("emergency connection close due to failed shutdown\n");
conn_close_with_partner_check(&conn_list,&close_list,conn);
continue;
}
}
}