X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DED303858431
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1692966236;
	bh=vYUlxCu4NNempHvgY1VYy9CVqU66JTreLJCGDDFwfbU=;
	h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
	 From;
	b=vMLv5LKnDQHL2EmaYaZs+JmBlJ/aMvBl2RRV0uaO/rrsSVDGA+6H7nF3GhojTuAok
	 TWV1HybsPCgzGOPyNdf8x8ucggV1z90fszM1axYnQz/BC1tRpBbUgLAhCWZfzAZK8l
	 Vj4LK8EFepcdUkT6FX0muhRBPeEwBZDEq0guyE3M=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F1F4C3858C53
Date: Fri, 25 Aug 2023 14:23:16 +0200
To: cygwin@cygwin.com
Subject: Re: [EXTERNAL] Re: scp stalls on uploading in cygwin 3.5 current
 master.
Message-ID: <ZOidNPZSXvaecVJc@calimero.vinschen.de>
Mail-Followup-To: cygwin@cygwin.com
References: <20230824060502.c4798062cb19d4d35a5633ae@nifty.ne.jp>
 <20230824123131.390b4471915c963425c77608@nifty.ne.jp>
 <ZOcb9SKtMPTQfj/m@calimero.vinschen.de>
 <20230825174832.9ebae8112667d5d5411cb8db@nifty.ne.jp>
 <ZOiHkCWY7PK3livD@calimero.vinschen.de>
 <DM8PR09MB70957918F669340C497F48D5A5E3A@DM8PR09MB7095.namprd09.prod.outlook.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <DM8PR09MB70957918F669340C497F48D5A5E3A@DM8PR09MB7095.namprd09.prod.outlook.com>
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Corinna Vinschen via Cygwin <cygwin@cygwin.com>
Reply-To: cygwin@cygwin.com
Cc: Corinna Vinschen <corinna-cygwin@cygwin.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cygwin-bounces+archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>

On Aug 25 12:08, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin wrote:
> > I don't have an answer to this problem yet.
> > 
> > Can we use send(sock, "", 0) to reenable FD_WRITE, perhaps?
> 
> Can't it just be assumed that the socket is _always_ writeable _unless_ the last send() failed?
> In other words, try to always send() if it did not fail before.  If it did, only send() after
> FD_WRITE was returned in the event mask.

You're looking from the application perspective, but as the underlying
library we don't have the application under control.  The application
can rightfully expect POSIX-like behaviour from select(2), and *that*
means, it can expect select(2) to return a socket as non-writable if the
internal buffer is full, *before* it calls send:

  while (...)
    {
      /* send as long as we can, otherwise do another job in the meantime */
      while (select (..., <zero timeout>))
	send (<blocking>);
      <do something else>
    }


Corinna

-- 
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
