int sock = socket(sa.sa.sa_family, SOCK_STREAM, IPPROTO_TCP);
- if(sock != -1) {
+ if(sock == -1) {
continue;
}
}
/* Kick the ping timeout handler */
- timeout_set(&mesh->loop, &mesh->pingtimer, &(struct timespec) {
- 0, 0
- });
+ if(mesh->pingtimer.cb) {
+ timeout_set(&mesh->loop, &mesh->pingtimer, &(struct timespec) {
+ 0, 0
+ });
+ }
}
/*