On 12/17/2010 11:31 AM, Mike McCormack wrote: > On 12/17/2010 05:41 PM, Sebastian Dransfeld wrote: >> On 12/17/2010 09:06 AM, Sebastian Dransfeld wrote: >>> On 12/17/2010 05:30 AM, Mike McCormack wrote: >>>> On 12/17/2010 05:41 AM, Sebastian Dransfeld wrote: >>>> >>>>>> num = read(svr->fd, buf, sizeof(buf)); >>>>>> - if ((num> 0) || (errno == EAGAIN)) >>>>>> + if ((num>= 0) || (errno == EAGAIN)) >>>>>> lost_server = EINA_FALSE; >>>>> >>>>> Sure this is right? a ret 0 an errno != EAGAIN is probably a lost >>>>> server. >>>> >>>> 0 is a successful return, so errno is not set in that case. >>>> >>>> The above fix looks correct to me. >>> >>> Depends on how the main loop works. We had this discussion a while ago, >>> and the result was: >>> >>> http://trac.enlightenment.org/e/changeset/54209/trunk/ecore/src/lib/ecore_con/ecore_con.c >>> >>> >>> >> >> And: >> >> http://stackoverflow.com/questions/2416944/can-read-function-on-a-connected-socket-return-zero-bytes >> >> >> >> So 0 is _not_ a valid return value on a tcp socket. > > read doesn't touch errno if it returns 0, as the attached test show. > > If you think it behaves differently for a socket somehow, please extend > the test and show me.
I agree, errno isn't touched on 0 return, but it still does not mean that a 0 return isn't lost server. S. ------------------------------------------------------------------------------ Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
