/*
* If we get to this point, the supplied node name is bogus.
*/
- lprintf(5, "Invalid node name <%s>\n", node);
+ lprintf(CTDL_ERR, "Invalid node name <%s>\n", node);
return(-1);
}
/*
* allocate...
*/
- lprintf(9, "Generating delivery instructions\n");
+ lprintf(CTDL_DEBUG, "Generating delivery instructions\n");
instr = mallok(instr_len);
if (instr == NULL) {
- lprintf(1, "Cannot allocate %ld bytes for instr...\n",
+ lprintf(CTDL_EMERG, "Cannot allocate %ld bytes for instr...\n",
(long)instr_len);
abort();
}
/* Check for valid node name */
if (is_valid_node(NULL,NULL,nptr->name) != 0) {
- lprintf(3, "Invalid node <%s>\n",
+ lprintf(CTDL_ERR, "Invalid node <%s>\n",
nptr->name);
send = 0;
}
/* Check for split horizon */
- lprintf(9, "Path is %s\n", msg->cm_fields['P']);
+ lprintf(CTDL_DEBUG, "Path is %s\n", msg->cm_fields['P']);
bang = num_tokens(msg->cm_fields['P'], '!');
if (bang > 1) for (i=0; i<(bang-1); ++i) {
extract_token(buf, msg->cm_fields['P'],
/*
* allocate...
*/
- lprintf(9, "Generating delivery instructions\n");
+ lprintf(CTDL_DEBUG, "Generating delivery instructions\n");
instr = mallok(instr_len);
if (instr == NULL) {
- lprintf(1, "Cannot allocate %ld bytes for instr...\n",
+ lprintf(CTDL_EMERG, "Cannot allocate %ld bytes for instr...\n",
(long)instr_len);
abort();
}
int i;
if (getroom(&CC->room, room_to_spool) != 0) {
- lprintf(1, "ERROR: cannot load <%s>\n", room_to_spool);
+ lprintf(CTDL_CRIT, "ERROR: cannot load <%s>\n", room_to_spool);
return;
}
return;
}
- lprintf(5, "Networking started for <%s>\n", CC->room.QRname);
+ lprintf(CTDL_INFO, "Networking started for <%s>\n", CC->room.QRname);
while (fgets(buf, sizeof buf, fp) != NULL) {
buf[strlen(buf)-1] = 0;
/* Now rewrite the config file */
fp = fopen(filename, "w");
if (fp == NULL) {
- lprintf(1, "ERROR: cannot open %s: %s\n",
+ lprintf(CTDL_CRIT, "ERROR: cannot open %s: %s\n",
filename, strerror(errno));
}
else {
/* Concise cleanup because we know there's only one node in the sc */
phree(sc.ignet_push_shares);
- lprintf(7, "Synchronized %d messages to <%s>\n",
+ lprintf(CTDL_INFO, "Synchronized %d messages to <%s>\n",
num_spooled, target_node);
return(num_spooled);
}
static int serialnum = 0;
size_t size;
- lprintf(9, "entering network_bounce()\n");
+ lprintf(CTDL_DEBUG, "entering network_bounce()\n");
if (msg == NULL) return;
/* Clean up */
if (valid != NULL) phree(valid);
CtdlFreeMessage(msg);
- lprintf(9, "leaving network_bounce()\n");
+ lprintf(CTDL_DEBUG, "leaving network_bounce()\n");
}
memcpy(&firstbyte, &buffer[0], 1);
memcpy(&lastbyte, &buffer[size-1], 1);
if ( (firstbyte != 255) || (lastbyte != 0) ) {
- lprintf(7, "Corrupt message! Ignoring.\n");
+ lprintf(CTDL_ERR, "Corrupt message! Ignoring.\n");
return;
}
fp = fopen(filename, "rb");
if (fp == NULL) {
- lprintf(5, "Error opening %s: %s\n",
+ lprintf(CTDL_CRIT, "Error opening %s: %s\n",
filename, strerror(errno));
return;
}
- lprintf(5, "network: processing <%s>\n", filename);
+ lprintf(CTDL_INFO, "network: processing <%s>\n", filename);
/* Look for messages in the data stream and break them out */
while (ch = getc(fp), ch >= 0) {
strcpy(tempfilename, tmpnam(NULL));
if (sock_puts(sock, "NDOP") < 0) return;
if (sock_gets(sock, buf) < 0) return;
- lprintf(9, "<%s\n", buf);
+ lprintf(CTDL_DEBUG, "<%s\n", buf);
if (buf[0] != '2') {
return;
}
bytes_received = 0L;
fp = fopen(tempfilename, "w");
if (fp == NULL) {
- lprintf(9, "cannot open download file locally: %s\n",
+ lprintf(CTDL_CRIT, "cannot open download file locally: %s\n",
strerror(errno));
return;
}
unlink(tempfilename);
return;
}
- lprintf(9, "%s\n", buf);
+ lprintf(CTDL_DEBUG, "%s\n", buf);
snprintf(buf, sizeof buf, "mv %s ./network/spoolin/%s.%ld",
tempfilename, remote_nodename, (long) getpid());
system(buf);
if (sock_puts(sock, "NUOP") < 0) return;
if (sock_gets(sock, buf) < 0) return;
- lprintf(9, "<%s\n", buf);
+ lprintf(CTDL_DEBUG, "<%s\n", buf);
if (buf[0] != '2') {
return;
}
fd = open(sfname, O_RDONLY);
if (fd < 0) {
if (errno == ENOENT) {
- lprintf(9, "Nothing to send.\n");
+ lprintf(CTDL_INFO, "Nothing to send.\n");
} else {
- lprintf(5, "cannot open upload file locally: %s\n",
+ lprintf(CTDL_CRIT, "cannot open upload file locally: %s\n",
strerror(errno));
}
return;
close(fd);
if (sock_puts(sock, "UCLS 1") < 0) return;
if (sock_gets(sock, buf) < 0) return;
- lprintf(9, "<%s\n", buf);
+ lprintf(CTDL_DEBUG, "<%s\n", buf);
if (buf[0] == '2') {
unlink(sfname);
}
if (network_talking_to(node, NTT_CHECK)) return;
network_talking_to(node, NTT_ADD);
- lprintf(5, "Polling node <%s> at %s:%s\n", node, host, port);
+ lprintf(CTDL_INFO, "Polling node <%s> at %s:%s\n", node, host, port);
sock = sock_connect(host, port, "tcp");
if (sock < 0) {
- lprintf(7, "Could not connect: %s\n", strerror(errno));
+ lprintf(CTDL_ERR, "Could not connect: %s\n", strerror(errno));
network_talking_to(node, NTT_REMOVE);
return;
}
- lprintf(9, "Connected!\n");
+ lprintf(CTDL_DEBUG, "Connected!\n");
/* Read the server greeting */
if (sock_gets(sock, buf) < 0) goto bail;
- lprintf(9, ">%s\n", buf);
+ lprintf(CTDL_DEBUG, ">%s\n", buf);
/* Identify ourselves */
snprintf(buf, sizeof buf, "NETP %s|%s", config.c_nodename, secret);
- lprintf(9, "<%s\n", buf);
+ lprintf(CTDL_DEBUG, "<%s\n", buf);
if (sock_puts(sock, buf) <0) goto bail;
if (sock_gets(sock, buf) < 0) goto bail;
- lprintf(9, ">%s\n", buf);
+ lprintf(CTDL_DEBUG, ">%s\n", buf);
if (buf[0] != '2') goto bail;
/* At this point we are authenticated. */
* Go ahead and run the queue
*/
if (full_processing) {
- lprintf(7, "network: loading outbound queue\n");
+ lprintf(CTDL_INFO, "network: loading outbound queue\n");
ForEachRoom(network_queue_room, NULL);
- lprintf(7, "network: running outbound queue\n");
+ lprintf(CTDL_INFO, "network: running outbound queue\n");
while (rplist != NULL) {
network_spoolout_room(rplist->name);
ptr = rplist;
}
}
- lprintf(7, "network: processing inbound queue\n");
+ lprintf(CTDL_INFO, "network: processing inbound queue\n");
network_do_spoolin();
/* Save the network map back to disk */
network_purge_spoolout();
- lprintf(7, "network: queue run completed\n");
+ lprintf(CTDL_INFO, "network: queue run completed\n");
if (full_processing) {
last_run = time(NULL);