Skip to content

Instantly share code, notes, and snippets.

@jolexa
Created November 10, 2015 02:45
Show Gist options
  • Save jolexa/ee9e152aa7045c558e02 to your computer and use it in GitHub Desktop.
Save jolexa/ee9e152aa7045c558e02 to your computer and use it in GitHub Desktop.
mesos socket keepalive
$ git diff
diff --git a/3rdparty/libprocess/include/process/network.hpp b/3rdparty/libprocess/include/process/network.hpp
index 61bfa82..32c14e3 100644
--- a/3rdparty/libprocess/include/process/network.hpp
+++ b/3rdparty/libprocess/include/process/network.hpp
@@ -44,6 +44,10 @@ inline Try<int> socket(int family, int type, int protocol)
return ErrnoError();
}
#endif // __APPLE__
+ const int enable = 1;
+ if (setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, &enable, sizeof(int)) == -1) {
+ return ErrnoError();
+ }
return s;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment