diff options
author | Robert Gustafsson <robg@student.chalmers.se> | 2017-10-12 10:09:56 +0200 |
---|---|---|
committer | Robert Gustafsson <robg@student.chalmers.se> | 2017-10-12 10:11:23 +0200 |
commit | 8664b4c13a215221a1c26a6bc1de47226949b35d (patch) | |
tree | 61fa722a085d29618de9c154ba00e8ad1dda87ad /broccoli/src | |
parent | 51048c85dd437d501ca82cdc7bb4edc4bb686100 (diff) | |
download | midbro-8664b4c13a215221a1c26a6bc1de47226949b35d.tar.gz midbro-8664b4c13a215221a1c26a6bc1de47226949b35d.tar.bz2 |
Add debug mode
Diffstat (limited to 'broccoli/src')
-rw-r--r-- | broccoli/src/broevent.c | 7 | ||||
-rw-r--r-- | broccoli/src/fifoqueue.c | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/broccoli/src/broevent.c b/broccoli/src/broevent.c index 8a74881..206ce17 100644 --- a/broccoli/src/broevent.c +++ b/broccoli/src/broevent.c @@ -26,12 +26,15 @@ pasad_register_received(BroConn *conn, void *data, BroRecord *record) // TODO: handle error return; } - + #ifdef DEBUG printf("Received value %"PRIu64" from uid=%"PRIu64"\n",*value,*address); + #endif add_to_queue(q, create_sensor_object(*value, *address)); + #ifdef DEBUG printf("Added to queue.\n"); + #endif } void * @@ -71,7 +74,7 @@ bro_event_listener(void * args) FD_ZERO(&rfds); FD_SET(fd,&rfds); if(select(fd+1,&rfds,NULL,NULL,NULL) == -1){ - perror("select()"); + printf("select(): Bad file descriptor"); break; } diff --git a/broccoli/src/fifoqueue.c b/broccoli/src/fifoqueue.c index 7e30e37..aeeced9 100644 --- a/broccoli/src/fifoqueue.c +++ b/broccoli/src/fifoqueue.c @@ -67,7 +67,9 @@ pop_from_queue(Fifo_q * q) { int semStat; if(is_empty(q)){ + #ifdef DEBUG printf("Waiting for sensor data\n"); + #endif sem_wait(&q->bufferEmptyBlock); } sem_wait(&q->lock); |