* When processing inbound network spool, ignore "." and ".." instead of
failing on them.
+ Revision 647.17 2005/05/20 20:02:50 ajc
+ * The IGnet map is now rewritten to disk only when it changes.
+ * When processing inbound network spool, ignore "." and ".." instead of
+ failing on them.
+
Revision 647.16 2005/05/20 16:22:33 ajc
Revision 647.16 2005/05/20 16:22:33 ajc
- *** empty log message ***
+ Fixed some errors in the ChangeLog
Revision 647.15 2005/05/20 16:14:43 ajc
* Dramatically improved the time it takes to goto (or select) a room which
Revision 647.15 2005/05/20 16:14:43 ajc
* Dramatically improved the time it takes to goto (or select) a room which
* We build a map of network nodes during processing.
*/
struct NetMap *the_netmap = NULL;
* We build a map of network nodes during processing.
*/
struct NetMap *the_netmap = NULL;
char *working_ignetcfg = NULL;
/*
char *working_ignetcfg = NULL;
/*
char *serialized_map = NULL;
struct NetMap *nmptr;
char *serialized_map = NULL;
struct NetMap *nmptr;
- serialized_map = strdup("");
- if (the_netmap != NULL) {
- for (nmptr = the_netmap; nmptr != NULL; nmptr = nmptr->next) {
- serialized_map = realloc(serialized_map,
- (strlen(serialized_map)+SIZ) );
- if (strlen(nmptr->nodename) > 0) {
- snprintf(&serialized_map[strlen(serialized_map)],
- SIZ,
- "%s|%ld|%s\n",
- nmptr->nodename,
- (long)nmptr->lastcontact,
- nmptr->nexthop);
+ if (netmap_changed) {
+ serialized_map = strdup("");
+
+ if (the_netmap != NULL) {
+ for (nmptr = the_netmap; nmptr != NULL; nmptr = nmptr->next) {
+ serialized_map = realloc(serialized_map,
+ (strlen(serialized_map)+SIZ) );
+ if (strlen(nmptr->nodename) > 0) {
+ snprintf(&serialized_map[strlen(serialized_map)],
+ SIZ,
+ "%s|%ld|%s\n",
+ nmptr->nodename,
+ (long)nmptr->lastcontact,
+ nmptr->nexthop);
+ }
- CtdlPutSysConfig(IGNETMAP, serialized_map);
- free(serialized_map);
+ CtdlPutSysConfig(IGNETMAP, serialized_map);
+ free(serialized_map);
+ }
/* Now free the list */
while (the_netmap != NULL) {
/* Now free the list */
while (the_netmap != NULL) {
free(the_netmap);
the_netmap = nmptr;
}
free(the_netmap);
the_netmap = nmptr;
}
if (!strcasecmp(nmptr->nodename, node)) {
extract_token(nmptr->nexthop, path, 0, '!', sizeof nmptr->nexthop);
nmptr->lastcontact = time(NULL);
if (!strcasecmp(nmptr->nodename, node)) {
extract_token(nmptr->nexthop, path, 0, '!', sizeof nmptr->nexthop);
nmptr->lastcontact = time(NULL);
extract_token(nmptr->nexthop, path, 0, '!', sizeof nmptr->nexthop);
nmptr->next = the_netmap;
the_netmap = nmptr;
extract_token(nmptr->nexthop, path, 0, '!', sizeof nmptr->nexthop);
nmptr->next = the_netmap;
the_netmap = nmptr;
void network_do_spoolin(void) {
DIR *dp;
struct dirent *d;
void network_do_spoolin(void) {
DIR *dp;
struct dirent *d;
dp = opendir("./network/spoolin");
if (dp == NULL) return;
while (d = readdir(dp), d != NULL) {
dp = opendir("./network/spoolin");
if (dp == NULL) return;
while (d = readdir(dp), d != NULL) {
- snprintf(filename, sizeof filename,
- "./network/spoolin/%s", d->d_name);
- network_process_file(filename);
+ if ((strcmp(d->d_name, ".")) && (strcmp(d->d_name, ".."))) {
+ snprintf(filename, sizeof filename,
+ "./network/spoolin/%s", d->d_name);
+ network_process_file(filename);
+ }
void network_purge_spoolout(void) {
DIR *dp;
struct dirent *d;
void network_purge_spoolout(void) {
DIR *dp;
struct dirent *d;
- char filename[SIZ];
- char nexthop[SIZ];
+ char filename[256];
+ char nexthop[256];
int i;
dp = opendir("./network/spoolout");
int i;
dp = opendir("./network/spoolout");