Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
591efb6d
"vscode:/vscode.git/clone" did not exist on "b40d0dc3d65e84fca7eec1689d238c9943d37db5"
Commit
591efb6d
authored
Jun 07, 2017
by
Guolin Ke
Browse files
reduce socket buffer size.
parent
dd3be8de
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
src/network/socket_wrapper.hpp
src/network/socket_wrapper.hpp
+5
-5
No files found.
src/network/socket_wrapper.hpp
View file @
591efb6d
...
...
@@ -81,8 +81,8 @@ inline int inet_pton(int af, const char *src, void *dst)
#define FREE(x) HeapFree(GetProcessHeap(), 0, (x))
namespace
SocketConfig
{
const
int
kSocketBufferSize
=
10
*
1024
*
1024
;
const
int
kMaxReceiveSize
=
2
*
1024
*
1024
;
const
int
kSocketBufferSize
=
10
0
*
1024
;
const
int
kMaxReceiveSize
=
100
*
1024
;
const
bool
kNoDelay
=
true
;
}
...
...
@@ -119,9 +119,9 @@ public:
if
(
sockfd_
==
INVALID_SOCKET
)
{
return
;
}
setsockopt
(
sockfd_
,
SOL_SOCKET
,
SO_RCVBUF
,
reinterpret_cast
<
const
char
*>
(
&
SocketConfig
::
kSocketBufferSize
),
sizeof
(
SocketConfig
::
kSocketBufferSize
));
setsockopt
(
sockfd_
,
SOL_SOCKET
,
SO_SNDBUF
,
reinterpret_cast
<
const
char
*>
(
&
SocketConfig
::
kSocketBufferSize
),
sizeof
(
SocketConfig
::
kSocketBufferSize
));
setsockopt
(
sockfd_
,
IPPROTO_TCP
,
TCP_NODELAY
,
reinterpret_cast
<
const
char
*>
(
&
SocketConfig
::
kNoDelay
),
sizeof
(
SocketConfig
::
kNoDelay
));
CHECK
(
setsockopt
(
sockfd_
,
SOL_SOCKET
,
SO_RCVBUF
,
reinterpret_cast
<
const
char
*>
(
&
SocketConfig
::
kSocketBufferSize
),
sizeof
(
SocketConfig
::
kSocketBufferSize
))
==
0
)
;
CHECK
(
setsockopt
(
sockfd_
,
SOL_SOCKET
,
SO_SNDBUF
,
reinterpret_cast
<
const
char
*>
(
&
SocketConfig
::
kSocketBufferSize
),
sizeof
(
SocketConfig
::
kSocketBufferSize
))
==
0
)
;
CHECK
(
setsockopt
(
sockfd_
,
IPPROTO_TCP
,
TCP_NODELAY
,
reinterpret_cast
<
const
char
*>
(
&
SocketConfig
::
kNoDelay
),
sizeof
(
SocketConfig
::
kNoDelay
))
==
0
)
;
}
inline
static
void
Startup
()
{
...
...
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