return (unsigned int)(*nid);
}
+void
+close_connection(void *arg)
+{
+ connection c = arg;
+
+ close(c->fd);
+ free(c);
+}
/* Function: remove_connection
* Arguments: c: the connection to remove
connection c = arg;
hash_table_remove(c->m->connections,&c->peer_nid);
- close(c->fd);
- free(c);
+ close_connection(c);
}
close(m->bound);
remove_io_handler(m->bound_handler);
#endif
- hash_destroy_table(m->connections,remove_connection);
+ hash_destroy_table(m->connections,close_connection);
free(m);
}
if ((p->nal_flags & NAL_FLAG_STOPPING) == 0)
return;
+ tcpnal_shutdown(b);
+
pthread_mutex_lock(&p->mutex);
p->nal_flags |= NAL_FLAG_STOPPED;
pthread_cond_broadcast(&p->cond);
pthread_mutex_unlock(&p->mutex);
- tcpnal_shutdown(b);
pthread_exit(0);
}
return (unsigned int)(*nid);
}
+void
+close_connection(void *arg)
+{
+ connection c = arg;
+
+ close(c->fd);
+ free(c);
+}
/* Function: remove_connection
* Arguments: c: the connection to remove
connection c = arg;
hash_table_remove(c->m->connections,&c->peer_nid);
- close(c->fd);
- free(c);
+ close_connection(c);
}
close(m->bound);
remove_io_handler(m->bound_handler);
#endif
- hash_destroy_table(m->connections,remove_connection);
+ hash_destroy_table(m->connections,close_connection);
free(m);
}
if ((p->nal_flags & NAL_FLAG_STOPPING) == 0)
return;
+ tcpnal_shutdown(b);
+
pthread_mutex_lock(&p->mutex);
p->nal_flags |= NAL_FLAG_STOPPED;
pthread_cond_broadcast(&p->cond);
pthread_mutex_unlock(&p->mutex);
- tcpnal_shutdown(b);
pthread_exit(0);
}