+ if (!nfds)
+ return 0;
+#if HAVE_SYS_POLL_H
+ yaz_log (LOG_LOG, "poll start");
+ r = poll (pollfds, nfds, 15000);
+ yaz_log (LOG_LOG, "poll stop, returned r=%d", r);
+ for (i = 0; i<nfds; i++)
+ {
+ Z3950_connection c = poll_cs[i];
+ if (r && c->mask)
+ {
+ int mask = 0;
+ if (pollfds[i].revents & POLLIN)
+ mask += Z3950_SELECT_READ;
+ if (pollfds[i].revents & POLLOUT)
+ mask += Z3950_SELECT_WRITE;
+ if (pollfds[i].revents & POLLERR)
+ mask += Z3950_SELECT_EXCEPT;
+ if (mask)
+ Z3950_connection_do_io(c, mask);
+ }
+ else if (r == 0 && c->mask)
+ {
+ Z3950_Event event = Z3950_Event_create(0);
+ /* timeout and this connection was waiting */
+ c->error = Z3950_ERROR_TIMEOUT;
+ do_close (c);
+ Z3950_connection_put_event(c, event);
+ }
+ }
+#else
+ yaz_log (LOG_DEBUG, "select start");
+ r = select (max_fd+1, &input, &output, &except, &tv);
+ yaz_log (LOG_DEBUG, "select stop, returned r=%d", r);