summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/net/SocketDescriptor.cxx9
-rw-r--r--src/net/SocketDescriptor.hxx8
2 files changed, 15 insertions, 2 deletions
diff --git a/src/net/SocketDescriptor.cxx b/src/net/SocketDescriptor.cxx
index db15cd32d..f0873520d 100644
--- a/src/net/SocketDescriptor.cxx
+++ b/src/net/SocketDescriptor.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2017 Max Kellermann <max.kellermann@gmail.com>
+ * Copyright 2012-2019 Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -316,6 +316,13 @@ SocketDescriptor::SetTcpDeferAccept(const int &seconds) noexcept
}
bool
+SocketDescriptor::SetTcpUserTimeout(const unsigned &milliseconds) noexcept
+{
+ return SetOption(IPPROTO_TCP, TCP_USER_TIMEOUT,
+ &milliseconds, sizeof(milliseconds));
+}
+
+bool
SocketDescriptor::SetV6Only(bool value) noexcept
{
return SetBoolOption(IPPROTO_IPV6, IPV6_V6ONLY, value);
diff --git a/src/net/SocketDescriptor.hxx b/src/net/SocketDescriptor.hxx
index 3f0c284ae..99643acbb 100644
--- a/src/net/SocketDescriptor.hxx
+++ b/src/net/SocketDescriptor.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2017 Max Kellermann <max.kellermann@gmail.com>
+ * Copyright 2012-2019 Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -188,6 +188,12 @@ public:
bool SetCork(bool value=true) noexcept;
bool SetTcpDeferAccept(const int &seconds) noexcept;
+
+ /**
+ * Setter for TCP_USER_TIMEOUT.
+ */
+ bool SetTcpUserTimeout(const unsigned &milliseconds) noexcept;
+
bool SetV6Only(bool value) noexcept;
/**