> > Can we use send(sock, "", 0) to reenable FD_WRITE, perhaps?
> 
> Your idea seems to work. The following patch looks to solve the issue.
> Is it supposed to be any side effect()?

IMO you're triggering an undefined (or not well-defined) behavior, because of 
the murky status
of the byte count of 0.  It may work now, but it may not work in the future...

RETURN VALUE
       On  success,  the  number of bytes written is returned (zero indicates 
nothing was written).  On error, -1 is returned, and
       errno is set appropriately.

       If count is zero and fd refers to a regular file, then write() may 
return a failure status if one of the  errors  below  is
       detected.   If no errors are detected, 0 will be returned without 
causing any other effect.  If count is zero and fd refers
       to a file other than a regular file, the results are not specified.

Anton Lavrentiev
Contractor NIH/NLM/NCBI

P.S.

Think of the effects of "recv(sock, buf, 0)" along the lines: the only valid 
return values in this
case would be -1 and 0, whereas 0 [usually] means EOF, but would it be really 
meant in this case?


-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to