chenBright commented on code in PR #2098:
URL: https://github.com/apache/brpc/pull/2098#discussion_r1091834224
##########
src/brpc/socket.cpp:
##########
@@ -590,6 +592,69 @@ int Socket::ResetFileDescriptor(int fd) {
return 0;
}
+void Socket::SetKeepalive(int fd) {
Review Comment:
done
##########
src/brpc/socket.cpp:
##########
@@ -590,6 +592,69 @@ int Socket::ResetFileDescriptor(int fd) {
return 0;
}
+void Socket::SetKeepalive(int fd) {
+ if (!_keepalive_options) {
Review Comment:
done
##########
src/brpc/socket.cpp:
##########
@@ -590,6 +592,69 @@ int Socket::ResetFileDescriptor(int fd) {
return 0;
}
+void Socket::SetKeepalive(int fd) {
+ if (!_keepalive_options) {
+ return;
+ } else {
+ int keep_alive = 1;
+ socklen_t size = sizeof(keep_alive);
+ if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &keep_alive, size)!=0) {
+ LOG(FATAL) << "Fail to set keepalive of fd=" << fd;
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]