Skip to content

Commit

Permalink
diod: log listen addresses
Browse files Browse the repository at this point in the history
Problem: it may be useful, especially when debugging, to know
what ports and interfaces diod is listening on.

Log this when diod starts up.

Redirect log output to a file in tests/misc/t15 to avoid this causing
a test failure.
  • Loading branch information
garlick committed Jan 19, 2025
1 parent 1787812 commit a621f52
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/libdiod/diod_rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/signal.h>
#include <sys/param.h>
Expand Down Expand Up @@ -103,6 +104,10 @@ diod_rdma_listen (diod_rdma_t rdma)
if (n)
errn (n, "rdma_listen");

msg ("Listening on rdma %s:%d",
inet_ntoa (rdma->addr.sin_addr),
rdma_port);

return 0;
}

Expand Down
3 changes: 3 additions & 0 deletions src/libdiod/diod_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ _setup_one_inet (char *host, char *port, struct pollfd **fdsp, int *nfdsp)
break;
count++;
}
if (count > 0)
msg ("Listening on %s:%s", host, port);
done:
if (res)
freeaddrinfo (res);
Expand Down Expand Up @@ -211,6 +213,7 @@ _setup_one_unix (char *path, struct pollfd **fdsp, int *nfdsp)
}
if (_poll_add (fdsp, nfdsp, fd) < 0)
goto error;
msg ("Listening on %s", path);
return 1;
error:
if (fd != -1)
Expand Down
2 changes: 1 addition & 1 deletion tests/misc/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ LDADD = $(top_builddir)/src/cmd/opt.o \
$(top_builddir)/src/liblsd/liblsd.a \
$(LIBPTHREAD) $(LUA_LIB) $(LIBMUNGE) $(LIBCAP) $(LIBTCMALLOC)

EXTRA_DIST = $(TESTS) $(TESTS:%=%.exp) memcheck valgrind.supp
EXTRA_DIST = $(TESTS) memcheck valgrind.supp
2 changes: 1 addition & 1 deletion tests/misc/t15
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ bg_test ()
TEST=$(basename $0 | cut -d- -f1)
sockfile=$(mktemp)
bg_test $sockfile &
${MISC_SRCDIR}/memcheck ${TOP_BUILDDIR}/src/cmd/diod -c /dev/null -n -e ctl -l $sockfile -s >$TEST.out 2>&1
${MISC_SRCDIR}/memcheck ${TOP_BUILDDIR}/src/cmd/diod -L $TEST.diod -c /dev/null -n -e ctl -l $sockfile -s >$TEST.out 2>&1
diff ${MISC_SRCDIR}/$TEST.exp $TEST.out >$TEST.diff
rm -f $sockfile
wait %1

0 comments on commit a621f52

Please sign in to comment.