summaryrefslogtreecommitdiff
path: root/implementation/endpoints/src/tcp_client_endpoint_impl.cpp
diff options
context:
space:
mode:
authorJuergen Gehring <juergen.gehring@bmw.de>2017-04-07 03:30:13 -0700
committerJuergen Gehring <juergen.gehring@bmw.de>2017-04-07 03:30:13 -0700
commit5315798ff81796217b55eb8c622f154bb0a1c487 (patch)
treea414da54a2ab36be5fbc2c95e551585c41cbc6f8 /implementation/endpoints/src/tcp_client_endpoint_impl.cpp
parentc35b82a9459b866ab22bc3cabe274c7b36bca290 (diff)
downloadvSomeIP-5315798ff81796217b55eb8c622f154bb0a1c487.tar.gz
vSomeIP 2.6.22.6.2maintain/2.6
Diffstat (limited to 'implementation/endpoints/src/tcp_client_endpoint_impl.cpp')
-rw-r--r--implementation/endpoints/src/tcp_client_endpoint_impl.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/implementation/endpoints/src/tcp_client_endpoint_impl.cpp b/implementation/endpoints/src/tcp_client_endpoint_impl.cpp
index 916c78a..4afe3ef 100644
--- a/implementation/endpoints/src/tcp_client_endpoint_impl.cpp
+++ b/implementation/endpoints/src/tcp_client_endpoint_impl.cpp
@@ -67,6 +67,12 @@ void tcp_client_endpoint_impl::connect() {
<< "Nagle algorithm: " << its_error.message();
}
+ socket_.set_option(boost::asio::socket_base::keep_alive(true), its_error);
+ if (its_error) {
+ VSOMEIP_WARNING << "tcp_client_endpoint::connect: couldn't enable "
+ << "keep_alive: " << its_error.message();
+ }
+
// Enable SO_REUSEADDR to avoid bind problems with services going offline
// and coming online again and the user has specified only a small number
// of ports in the clients section for one service instance
@@ -351,8 +357,9 @@ void tcp_client_endpoint_impl::receive_cbk(
receive();
} else {
if (_error == boost::asio::error::connection_reset ||
- _error == boost::asio::error::eof) {
- VSOMEIP_TRACE << "tcp_client_endpoint: connection_reseted/EOF ~> close socket!";
+ _error == boost::asio::error::eof ||
+ _error == boost::asio::error::timed_out) {
+ VSOMEIP_WARNING << "tcp_client_endpoint receive_cbk error detected: " << _error.message();
shutdown_and_close_socket();
} else {
receive();