Check if already started.

This commit is contained in:
Nicolás A. Ortega 2017-08-01 14:52:57 -05:00
parent 7222ad3e2a
commit 84ba3aa83c
No known key found for this signature in database
GPG Key ID: 3D786FB3123FF1DD

View File

@ -50,7 +50,7 @@ static struct NeoComm_directory_node *node_list;
static unsigned int max_nodes;
static unsigned int num_nodes;
static int run;
static int run = 0;
static int sockfd;
static pthread_t accept_thread;
@ -151,6 +151,11 @@ void *NeoComm_connect_manager() {
int NeoComm_init_directory(const unsigned int max_num_nodes,
const unsigned short portnum) {
if(run)
{
NeoComm_error("Already running");
return 0;
}
if(max_num_nodes == 0)
{
NeoComm_error("Insufficient number of nodes");