- Timestamp:
- Mar 26, 2024, 3:30:16 PM (8 weeks ago)
- Branches:
- (u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
- Children:
- c557548eb377680a027b43841f5c96858e4e28d9
- Parents:
- bf5adf058537f0a83a68bcae3705ae81c3b87e22
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/links/ssiLink.cc
rbf5adf rb9861d 1885 1885 && (strcmp(request, "read") == 0)) 1886 1886 { 1887 if (s_isready(d->f_read)) return "ready"; 1888 #ifdef HAVE_POLL 1889 pollfd pfd; 1890 loop 1891 { 1892 /* Don't block. Return socket status immediately. */ 1893 pfd.fd=d->fd_read; 1894 pfd.events=POLLIN; 1895 //Print("test fd %d\n",d->fd_read); 1896 /* check with select: chars waiting: no -> not ready */ 1897 switch (si_poll(&pfd,1,0)) 1898 { 1899 case 0: /* not ready */ return "not ready"; 1900 case -1: /*error*/ return "error"; 1901 case 1: /*ready ? */ break; 1902 } 1903 #else 1887 1904 fd_set mask; 1888 1905 struct timeval wt; 1889 if (s_isready(d->f_read)) return "ready";1890 1906 if (FD_SETSIZE<=d->fd_read) 1891 1907 { … … 1910 1926 case 1: /*ready ? */ break; 1911 1927 } 1928 #endif 1912 1929 /* yes: read 1 char*/ 1913 1930 /* if \n, check again with select else ungetc(c), ready*/ … … 1940 1957 int slStatusSsiL(lists L, int timeout) 1941 1958 { 1959 PrintS("select 1\n"); 1942 1960 // input: L: a list with links of type 1943 1961 // ssi-connect, ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch. … … 1955 1973 int d_fd; 1956 1974 int s; 1957 #ifdef HAVE_POLL 1975 //#ifdef HAVE_POLL 1976 #if 0 1958 1977 int nfd=L->nr+1; 1959 1978 int wait_for=0; … … 1961 1980 for(int i=L->nr; i>=0; i--) 1962 1981 { 1982 pfd[i].fd=-1; 1963 1983 if (L->m[i].Typ()!=DEF_CMD) 1964 1984 { … … 1999 2019 if (timeout>0) timeout=timeout/1000000; 2000 2020 do_poll: 2001 s= poll(pfd,nfd,timeout);2021 s=si_poll(pfd,nfd,timeout); 2002 2022 if (s==-1) 2003 2023 { … … 2027 2047 return i+1; 2028 2048 } 2029 if (pfd[i].revents &POLLERR)2049 if (pfd[i].revents) // anything else 2030 2050 { 2031 2051 wait_for--; 2032 pfd[i].events=0; 2052 pfd[i].fd=-1; 2053 pfd[i].events=0; 2033 2054 } 2034 2055 } … … 2037 2058 } 2038 2059 // none ready, wait again: 2039 if ((timeout!=0)&&(wait_for>0)) goto do_poll; 2040 return 0; 2060 if ((timeout<0)&&(wait_for>0)) goto do_poll; 2061 if (timeout==0) return 0; 2062 return -1; 2041 2063 #else 2042 2064 fd_set mask, fdmask;
Note: See TracChangeset
for help on using the changeset viewer.