aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-09-12 16:43:25 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-09-12 16:43:25 +0200
commit640595f37fb58cdfe96731a5d993344bcdabcad0 (patch)
treeef139fea105fd5cbc2559a293e396211a28febf5 /src
parent7539b330f40275351e6d0aba8f314f5e4a7626e7 (diff)
downloaddabmod-640595f37fb58cdfe96731a5d993344bcdabcad0.tar.gz
dabmod-640595f37fb58cdfe96731a5d993344bcdabcad0.tar.bz2
dabmod-640595f37fb58cdfe96731a5d993344bcdabcad0.zip
Reuse socket address for DPD server
Diffstat (limited to 'src')
-rw-r--r--src/OutputUHDFeedback.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/OutputUHDFeedback.cpp b/src/OutputUHDFeedback.cpp
index a8f2c2e..22fa7eb 100644
--- a/src/OutputUHDFeedback.cpp
+++ b/src/OutputUHDFeedback.cpp
@@ -230,6 +230,12 @@ void OutputUHDFeedback::ServeFeedback()
addr.sin_port = htons(m_port);
addr.sin_addr.s_addr = htonl(INADDR_ANY);
+ const int reuse = 1;
+ if (setsockopt(m_server_sock, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse))
+ < 0) {
+ throw std::runtime_error("Can't reuse address for TCP socket");
+ }
+
if (bind(m_server_sock, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
close(m_server_sock);
throw std::runtime_error("Can't bind TCP socket");