Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MTProxy2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
MTProxy2
Commits
e65047ce
Commit
e65047ce
authored
Jul 18, 2019
by
levlam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable TCP keep-alive and lingering.
parent
e1acd116
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
+14
-9
mtproto-proxy.c
mtproto/mtproto-proxy.c
+1
-1
net-events.c
net/net-events.c
+13
-8
No files found.
mtproto/mtproto-proxy.c
View file @
e65047ce
...
...
@@ -2092,7 +2092,7 @@ void mtfront_pre_loop (void) {
}
if
(
!
workers
)
{
for
(
i
=
0
;
i
<
http_ports_num
;
i
++
)
{
init_listening_tcpv6_connection
(
http_sfd
[
i
],
&
ct_tcp_rpc_ext_server_mtfront
,
&
ext_rpc_methods
,
enable_ipv6
|
SM_LOWPRIO
|
SM_NOQACK
|
(
max_special_connections
?
SM_SPECIAL
:
0
));
init_listening_tcpv6_connection
(
http_sfd
[
i
],
&
ct_tcp_rpc_ext_server_mtfront
,
&
ext_rpc_methods
,
enable_ipv6
|
SM_LOWPRIO
|
(
domain_count
==
0
?
SM_NOQACK
:
0
)
|
(
max_special_connections
?
SM_SPECIAL
:
0
));
// assert (setsockopt (http_sfd[i], IPPROTO_TCP, TCP_MAXSEG, (int[]){1410}, sizeof (int)) >= 0);
// assert (setsockopt (http_sfd[i], IPPROTO_TCP, TCP_NODELAY, (int[]){1}, sizeof (int)) >= 0);
if
(
window_clamp
)
{
...
...
net/net-events.c
View file @
e65047ce
...
...
@@ -557,8 +557,9 @@ struct in_addr settings_addr;
int
server_socket
(
int
port
,
struct
in_addr
in_addr
,
int
backlog
,
int
mode
)
{
int
socket_fd
;
struct
linger
ling
=
{
0
,
0
};
//
struct linger ling = {0, 0};
int
flags
=
1
;
int
enable_tcp_keep_alive
=
0
;
if
((
socket_fd
=
new_socket
(
mode
,
1
))
==
-
1
)
{
return
-
1
;
...
...
@@ -574,16 +575,20 @@ int server_socket (int port, struct in_addr in_addr, int backlog, int mode) {
maximize_sndbuf
(
socket_fd
,
0
);
maximize_rcvbuf
(
socket_fd
,
0
);
}
assert
(
setsockopt
(
socket_fd
,
SOL_SOCKET
,
SO_KEEPALIVE
,
&
flags
,
sizeof
(
flags
))
>=
0
);
assert
(
flags
==
1
);
setsockopt
(
socket_fd
,
SOL_SOCKET
,
SO_LINGER
,
&
ling
,
sizeof
(
ling
));
//
setsockopt (socket_fd, SOL_SOCKET, SO_LINGER, &ling, sizeof (ling));
setsockopt
(
socket_fd
,
IPPROTO_TCP
,
TCP_NODELAY
,
&
flags
,
sizeof
(
flags
));
int
x
=
40
;
assert
(
setsockopt
(
socket_fd
,
IPPROTO_TCP
,
TCP_KEEPIDLE
,
&
x
,
sizeof
(
x
))
>=
0
);
assert
(
setsockopt
(
socket_fd
,
IPPROTO_TCP
,
TCP_KEEPINTVL
,
&
x
,
sizeof
(
x
))
>=
0
);
x
=
5
;
assert
(
setsockopt
(
socket_fd
,
IPPROTO_TCP
,
TCP_KEEPCNT
,
&
x
,
sizeof
(
x
))
>=
0
);
if
(
enable_tcp_keep_alive
)
{
assert
(
flags
==
1
);
assert
(
setsockopt
(
socket_fd
,
SOL_SOCKET
,
SO_KEEPALIVE
,
&
flags
,
sizeof
(
flags
))
>=
0
);
int
x
=
40
;
assert
(
setsockopt
(
socket_fd
,
IPPROTO_TCP
,
TCP_KEEPIDLE
,
&
x
,
sizeof
(
x
))
>=
0
);
assert
(
setsockopt
(
socket_fd
,
IPPROTO_TCP
,
TCP_KEEPINTVL
,
&
x
,
sizeof
(
x
))
>=
0
);
x
=
5
;
assert
(
setsockopt
(
socket_fd
,
IPPROTO_TCP
,
TCP_KEEPCNT
,
&
x
,
sizeof
(
x
))
>=
0
);
}
}
if
(
mode
&
SM_REUSE
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment