close(fd);
return(-1);
}
- if(listen(fd, 16) < 0) {
+ if(listen(fd, 128) < 0) {
close(fd);
return(-1);
}
close(fd);
return(-1);
}
- if(listen(fd, 16) < 0) {
+ if(listen(fd, 128) < 0) {
close(fd);
return(-1);
}
while(1) {
namelen = sizeof(name);
- block(tcp->fd, EV_READ, 0);
+ if(block(tcp->fd, EV_READ, 0) == 0)
+ goto out;
ns = accept(tcp->fd, (struct sockaddr *)&name, &namelen);
if(ns < 0) {
flog(LOG_ERR, "accept: %s", strerror(errno));
omalloc(tcp);
tcp->fd = fd;
tcp->sport = port;
- mustart(listenloop, tcp);
+ bufadd(listeners, mustart(listenloop, tcp));
if((fd = listensock4(port)) < 0) {
if(errno != EADDRINUSE) {
flog(LOG_ERR, "could not listen on IPv4 (port %i): %s", port, strerror(errno));
omalloc(tcp);
tcp->fd = fd;
tcp->sport = port;
- mustart(listenloop, tcp);
+ bufadd(listeners, mustart(listenloop, tcp));
}
}