From 99fc3898606bf9bc2a732facffc1a6fe6bfcf3a2 Mon Sep 17 00:00:00 2001 From: nsensfel Date: Tue, 7 Jan 2020 11:06:51 +0100 Subject: ... --- src/server/communication_node.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/server/communication_node.c') diff --git a/src/server/communication_node.c b/src/server/communication_node.c index c621f06..46b5f08 100644 --- a/src/server/communication_node.c +++ b/src/server/communication_node.c @@ -164,3 +164,36 @@ int relabsd_server_create_communication_node return 0; } + +void relabsd_server_destroy_communication_node +( + const char socket_name [const restrict static 1], + const int socket +) +{ + errno = 0; + + if (close(socket) == -1) + { + RELABSD_WARNING + ( + "Could not properly close the communication socket: %s.", + strerror(errno) + ); + } + + errno = 0; + + if (remove(socket_name) == -1) + { + RELABSD_ERROR + ( + "Could not remove communication node %s. Please delete it manually." + " Error: %s.", + socket_name, + strerror(errno) + ); + } + + RELABSD_S_DEBUG(RELABSD_DEBUG_PROGRAM_FLOW, "Destroyed communication node."); +} -- cgit v1.2.3-70-g09d2