2 * This module handles shared rooms, inter-Citadel mail, and outbound
3 * mailing list processing.
5 * Copyright (c) 2000-2017 by the citadel.org team
7 * This program is open source software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License, version 3.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
18 #include <libcitadel.h>
19 #include "ctdl_module.h"
20 #include "serv_extensions.h"
22 /*-----------------------------------------------------------------------------*
23 * Network maps: evaluate other nodes *
24 *-----------------------------------------------------------------------------*/
27 * network_talking_to() -- concurrency checker
29 static HashList *nttlist = NULL;
30 int CtdlNetworkTalkingTo(const char *nodename, long len, int operation)
37 begin_critical_section(S_NTTLIST);
43 nttlist = NewHash(1, NULL);
44 Put(nttlist, nodename, len, NewStrBufPlain(nodename, len), HFreeStrBuf);
45 syslog(LOG_DEBUG, "nttlist: added <%s>\n", nodename);
48 if ((nttlist == NULL) ||
49 (GetCount(nttlist) == 0))
51 Pos = GetNewHashPos(nttlist, 1);
52 if (GetHashPosFromKey (nttlist, nodename, len, Pos))
53 DeleteEntryFromHash(nttlist, Pos);
55 syslog(LOG_DEBUG, "nttlist: removed <%s>\n", nodename);
60 if ((nttlist == NULL) ||
61 (GetCount(nttlist) == 0))
63 if (GetHash(nttlist, nodename, len, &vdata))
65 syslog(LOG_DEBUG, "nttlist: have [%d] <%s>\n", retval, nodename);
69 end_critical_section(S_NTTLIST);
73 void cleanup_nttlist(void)
75 begin_critical_section(S_NTTLIST);
77 end_critical_section(S_NTTLIST);
86 CTDL_MODULE_INIT(nttlist)
90 CtdlRegisterCleanupHook(cleanup_nttlist);