Leave a notice in the log when aborting

This commit is contained in:
thorkill 2015-07-01 19:01:42 +02:00
parent 24cea32efb
commit dca3558d05
5 changed files with 32 additions and 11 deletions

View file

@ -19,6 +19,7 @@
#include "system.h"
#include "logger.h"
#include "dropin.h"
#include "event.h"
#include "net.h"
@ -85,8 +86,10 @@ void io_add(io_t *io, io_cb_t cb, void *data, int fd, int flags) {
io_set(io, flags);
if(!splay_insert_node(&io_tree, &io->node))
if(!splay_insert_node(&io_tree, &io->node)) {
logger(DEBUG_ALWAYS, LOG_ERR, "io_add(): could not insert node into io_tree. aborting!");
abort();
}
}
#ifdef HAVE_MINGW
@ -156,8 +159,10 @@ void timeout_set(timeout_t *timeout, struct timeval *tv) {
timeradd(&now, tv, &timeout->tv);
if(!splay_insert_node(&timeout_tree, &timeout->node))
if(!splay_insert_node(&timeout_tree, &timeout->node)) {
logger(DEBUG_ALWAYS, LOG_ERR, "timeout_set(): could not insert node into timeout_tree. aborting!");
abort();
}
}
void timeout_del(timeout_t *timeout) {
@ -212,8 +217,10 @@ void signal_add(signal_t *sig, signal_cb_t cb, void *data, int signum) {
signal(sig->signum, signal_handler);
if(!splay_insert_node(&signal_tree, &sig->node))
if(!splay_insert_node(&signal_tree, &sig->node)) {
logger(DEBUG_ALWAYS, LOG_ERR, "signal_add(): could not insert node into signal_tree. aborting!");
abort();
}
}
void signal_del(signal_t *sig) {

View file

@ -145,8 +145,10 @@ static void sssp_bfs(void) {
for list_each(node_t, n, todo_list) { /* "n" is the node from which we start */
logger(DEBUG_SCARY_THINGS, LOG_DEBUG, " Examining edges from %s", n->name);
if(n->distance < 0)
if(n->distance < 0) {
logger(DEBUG_ALWAYS, LOG_ERR, "sssp_bfs(): n->distance < 0. aborting!");
abort();
}
for splay_each(edge_t, e, n->edge_tree) { /* "e" is the edge connected to "from" */
if(!e->reverse)

View file

@ -268,7 +268,7 @@ bool receive_meta(connection_t *c) {
return false;
}
} else {
logger(DEBUG_CONNECTIONS, LOG_ERR, "c->tcplen set but c->node is NULL!");
logger(DEBUG_ALWAYS, LOG_ERR, "c->tcplen set but c->node is NULL!");
abort();
}
} else {

View file

@ -873,8 +873,10 @@ bool receive_sptps_record(void *handle, uint8_t type, const void *data, uint16_t
} else {
inpkt.len = ulen + offset;
}
if(inpkt.len > MAXSIZE)
if(inpkt.len > MAXSIZE) {
logger(DEBUG_ALWAYS, LOG_ERR, "receive_sptps_record(): inpkt.len > MAXSIZE. aborting!");
abort();
}
} else {
memcpy(DATA(&inpkt) + offset, data, len);
inpkt.len = len + offset;

View file

@ -299,8 +299,10 @@ bool req_key_h(connection_t *c, const char *request) {
}
bool send_ans_key(node_t *to) {
if(to->status.sptps && to->status.validkey_in)
if(to->status.sptps && to->status.validkey_in) {
logger(DEBUG_ALWAYS, LOG_ERR, "send_ans_key(): status.validkey_in set - aborting!");
abort();
}
#ifdef DISABLE_LEGACY
return false;
@ -315,18 +317,26 @@ bool send_ans_key(node_t *to) {
if(myself->incipher) {
to->incipher = cipher_open_by_nid(cipher_get_nid(myself->incipher));
if(!to->incipher)
if(!to->incipher) {
logger(DEBUG_ALWAYS, LOG_ERR, "send_ans_key(): cipher not set - aborting!");
abort();
if(!cipher_set_key(to->incipher, key, false))
}
if(!cipher_set_key(to->incipher, key, false)) {
logger(DEBUG_ALWAYS, LOG_ERR, "send_ans_key(): cipher_set_key() failed - aborting!");
abort();
}
}
if(myself->indigest) {
to->indigest = digest_open_by_nid(digest_get_nid(myself->indigest), digest_length(myself->indigest));
if(!to->indigest)
if(!to->indigest) {
logger(DEBUG_ALWAYS, LOG_ERR, "send_ans_key(): indigest not set - aborting!");
abort();
if(!digest_set_key(to->indigest, key, keylen))
}
if(!digest_set_key(to->indigest, key, keylen)) {
logger(DEBUG_ALWAYS, LOG_ERR, "send_ans_key(): digest_set_key() failed - aborting!");
abort();
}
}
to->incompression = myself->incompression;