Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
container-builder
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
olcf
container-builder
Commits
01616ab3
There was a problem fetching the pipeline summary.
Commit
01616ab3
authored
7 years ago
by
AdamSimpson
Browse files
Options
Downloads
Patches
Plain Diff
Set TCP keep alive values for builder queue correctly(hopefully)
parent
0d4ea284
No related branches found
Branches containing commit
Tags
0.2.4
Tags containing commit
No related merge requests found
Pipeline
#
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Builder/src/main.cpp
+0
-4
0 additions, 4 deletions
Builder/src/main.cpp
BuilderQueue/include/Connection.h
+3
-7
3 additions, 7 deletions
BuilderQueue/include/Connection.h
BuilderQueue/src/Connection.cpp
+22
-0
22 additions, 0 deletions
BuilderQueue/src/Connection.cpp
with
25 additions
and
11 deletions
Builder/src/main.cpp
+
0
−
4
View file @
01616ab3
...
...
@@ -193,10 +193,6 @@ int main(int argc, char *argv[]) {
acceptor
.
accept
(
client_stream
.
next_layer
());
client_stream
.
accept
();
// Use keep alive, which hopefully detect badly disconnected clients
boost
::
asio
::
socket_base
::
keep_alive
keep_alive
(
true
);
socket
.
set_option
(
keep_alive
);
Logger
::
info
(
"Setting the websocket stream to handle binary data and have an unlimited(uint64_t) message size"
);
client_stream
.
binary
(
true
);
client_stream
.
read_message_max
(
0
);
...
...
This diff is collapsed.
Click to expand it.
BuilderQueue/include/Connection.h
+
3
−
7
View file @
01616ab3
...
...
@@ -16,13 +16,7 @@ class Connection : public std::enable_shared_from_this<Connection> {
public:
explicit
Connection
(
tcp
::
socket
socket
,
BuilderQueue
&
queue
)
:
stream
(
std
::
move
(
socket
)),
queue
(
queue
)
{
// Use keep alive, which hopefully detect badly disconnected clients
boost
::
asio
::
socket_base
::
keep_alive
keep_alive
(
true
);
boost
::
system
::
error_code
ec
;
socket
.
set_option
(
keep_alive
,
ec
);
if
(
ec
)
{
Logger
::
error
(
"Error setting keep alive on socket"
);
}
enable_keep_alive
();
};
~
Connection
()
{
...
...
@@ -40,6 +34,8 @@ private:
beast
::
flat_buffer
buffer
;
boost
::
optional
<
BuilderData
>
builder
;
void
enable_keep_alive
();
void
read_request_string
();
void
request_builder
();
...
...
This diff is collapsed.
Click to expand it.
BuilderQueue/src/Connection.cpp
+
22
−
0
View file @
01616ab3
...
...
@@ -5,6 +5,28 @@
using
namespace
std
::
placeholders
;
void
Connection
::
enable_keep_alive
()
{
auto
socket
=
stream
.
next_layer
().
native_handle
();
// Enable keep alive
int
enable
=
1
;
int
rc
=
setsockopt
(
socket
,
SOL_SOCKET
,
SO_KEEPALIVE
,
&
enable
,
sizeof
(
enable
));
// Set keep alive values
unsigned
interval_milliseconds
=
30000
;
struct
timeval
tv
;
tv
.
tv_sec
=
interval_milliseconds
/
1000
;
tv
.
tv_usec
=
interval_milliseconds
%
1000
;
int
max_retry
=
5
;
rc
|=
setsockopt
(
socket
,
SOL_TCP
,
TCP_KEEPIDLE
,
&
tv
,
sizeof
(
tv
));
rc
|=
setsockopt
(
socket
,
SOL_TCP
,
TCP_KEEPINTVL
,
&
tv
,
sizeof
(
tv
));
rc
|=
setsockopt
(
socket
,
SOL_TCP
,
TCP_KEEPCNT
,
&
max_retry
,
sizeof
(
max_retry
));
if
(
rc
!=
0
)
{
Logger
::
error
(
std
::
string
(
"Error setting keepalive: "
)
+
strerror
(
errno
));
}
}
void
Connection
::
wait_for_close
()
{
// Persist this connection
auto
self
(
shared_from_this
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment