Skip to content

Commit

Permalink
Made bind send out a signal, and fixed a bug where the net
Browse files Browse the repository at this point in the history
thread closed before the signals.  Since most things depend on
signals they should be closed last.
  • Loading branch information
Nikhil Samith Bysani committed Dec 20, 2008
1 parent 8a440f9 commit 5358a46
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/base/bang-net.c
Expand Up @@ -6,6 +6,7 @@
* \brief Implementation of the networking behind the BANG project.
* */
#include"bang-net.h"
#include"bang-signals.h"
#include<stdio.h>
#include<errno.h>
#include<netdb.h>
Expand Down Expand Up @@ -49,9 +50,7 @@ void* BANG_network_thread(void *port) {
perror("Bind failed");
}
else if (bind(sock,rp->ai_addr,rp->ai_addrlen) == 0) {
/**
* TODO: Make this send out a signal before returning.
*/
BANG_send_signal(BANG_BIND_SUC,NULL);
printf("Bind succeeded.\n");
fflush(stdout);
break;
Expand Down
2 changes: 1 addition & 1 deletion src/base/core.c
Expand Up @@ -40,7 +40,7 @@ void BANG_init(int *argc, char **argv) {
}

void BANG_close() {
BANG_sig_close();
pthread_join(*netthread,NULL);
free(netthread);
BANG_sig_close();
}

0 comments on commit 5358a46

Please sign in to comment.