projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
(from parent 1:
35a6c9c
)
Merge pull request #2684 from rpv-tomsk/fix-2673
author
Pavel Rochnyak
<pavel2000@ngs.ru>
Sat, 10 Feb 2018 11:23:08 +0000
(18:23 +0700)
committer
GitHub
<noreply@github.com>
Sat, 10 Feb 2018 11:23:08 +0000
(18:23 +0700)
write_prometheus: Set SO_REUSEADDR on listening socket
src/write_prometheus.c
patch
|
blob
|
history
diff --git
a/src/write_prometheus.c
b/src/write_prometheus.c
index
97f583f
..
ba186a7
100644
(file)
--- a/
src/write_prometheus.c
+++ b/
src/write_prometheus.c
@@
-764,6
+764,16
@@
static int prom_open_socket(int addrfamily) {
if (fd == -1)
continue;
+ int tmp = 1;
+ if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(tmp)) != 0) {
+ char errbuf[1024];
+ WARNING("write_prometheus: setsockopt(SO_REUSEADDR) failed: %s",
+ sstrerror(errno, errbuf, sizeof(errbuf)));
+ close(fd);
+ fd = -1;
+ continue;
+ }
+
if (bind(fd, ai->ai_addr, ai->ai_addrlen) != 0) {
close(fd);
fd = -1;