X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fzoom-socket.c;h=c0b670ff074c178ab538411853d48bcebc23bb22;hp=119d68016d66e3de8da9e7076a6e294ae24fb5a4;hb=c2d4d247b3fe28f7c191fbc3644c8e011e1a4fea;hpb=3b792849c676d96918850e2f1e0af87a75278501 diff --git a/src/zoom-socket.c b/src/zoom-socket.c index 119d680..c0b670f 100644 --- a/src/zoom-socket.c +++ b/src/zoom-socket.c @@ -1,8 +1,6 @@ -/* - * Copyright (C) 1995-2007, Index Data ApS +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. - * - * $Id: zoom-socket.c,v 1.6 2007-11-09 22:08:14 adam Exp $ */ /** * \file zoom-socket.c @@ -29,7 +27,7 @@ ZOOM_API(int) ZOOM_event_sys_yaz_poll(int no, ZOOM_connection *cs) { - struct yaz_poll_fd *yp = xmalloc(sizeof(*yp) * no); + struct yaz_poll_fd *yp = (struct yaz_poll_fd *) xmalloc(sizeof(*yp) * no); int i, r; int nfds = 0; int timeout = 30; @@ -49,14 +47,14 @@ ZOOM_API(int) continue; if (mask) { - enum yaz_poll_mask input_mask = 0; + enum yaz_poll_mask input_mask = yaz_poll_none; if (mask & ZOOM_SELECT_READ) - input_mask += yaz_poll_read; + yaz_poll_add(input_mask, yaz_poll_read); if (mask & ZOOM_SELECT_WRITE) - input_mask += yaz_poll_write; + yaz_poll_add(input_mask, yaz_poll_write); if (mask & ZOOM_SELECT_EXCEPT) - input_mask += yaz_poll_except; + yaz_poll_add(input_mask, yaz_poll_except); yp[nfds].fd = fd; yp[nfds].input_mask = input_mask; yp[nfds].client_data = c; @@ -73,7 +71,7 @@ ZOOM_API(int) { for (i = 0; i < nfds; i++) { - ZOOM_connection c = yp[i].client_data; + ZOOM_connection c = (ZOOM_connection) yp[i].client_data; enum yaz_poll_mask output_mask = yp[i].output_mask; if (output_mask & yaz_poll_timeout) ZOOM_connection_fire_event_timeout(c); @@ -102,13 +100,15 @@ ZOOM_API(int) r = ZOOM_event_nonblock(no, cs); if (r) return r; - ZOOM_event_sys_yaz_poll(no, cs); + while (ZOOM_event_sys_yaz_poll(no, cs) < 0 && errno == EINTR) + ; return ZOOM_event_nonblock(no, cs); } /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab