X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 127F3385701F
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1593515541;
	bh=cVQpFzUo243cNfbIq14SVOT/RU2zDBFekHhBIsy6Pww=;
	h=Date:From:To:Subject:References:In-Reply-To:List-Id:
	 List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:
	 Reply-To:From;
	b=VMnEKJa3B+kxXrBEzbgkR3iyLhfBCDlmibBZruCOTOybXT7K9c/BCVklaDDFODXg2
	 txgarxenYjBD99klzj35utGqraLDjq4tMmltEF6uICFJYWIs1SJ+MB+ymvgnMGDnGe
	 Q+MV9xNYplCbNtupgrcegDTRexj0XpnkQwCNOgTk=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BEB143857003
Authentication-Results: sourceware.org;
 dmarc=none (p=none dis=none) header.from=cygwin.com
Authentication-Results: sourceware.org;
 spf=fail smtp.mailfrom=corinna-cygwin@cygwin.com
Date: Tue, 30 Jun 2020 13:12:15 +0200
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: TCP_KEEPINVTL and TCP_KEEPIDLE - Socket Keep Alives not working
Message-ID: <20200630111215.GE3499@calimero.vinschen.de>
Mail-Followup-To: cygwin@cygwin.com
References: <CAEF1h+WHsGXzSykQ0G3aXG=8jY5VmpYQQiYNP7DjHJTS1Bkpsw@mail.gmail.com>
 <ba71f855-276d-9d45-5c78-6d0a91dc57dd@cornell.edu>
 <CAEF1h+UuQmXz-ntG6YMed+DKFgikJT_aJN5Hu94ZnZ8_LGxMjQ@mail.gmail.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <CAEF1h+UuQmXz-ntG6YMed+DKFgikJT_aJN5Hu94ZnZ8_LGxMjQ@mail.gmail.com>
X-Provags-ID: V03:K1:O4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+5sOEwVPMzj9CmwlaCYUxdWDdb
 uN2k1oZ+RxyKtrf/jbDdH2qvJfzs5MzPdDBjMiZ72y3fcFE9fptaXtkgJ/Zm6FFxeAzrSn4
X-Spam-Status: No, score=-99.5 required=5.0 tests=BAYES_00,
 GOOD_FROM_CORINNA_CYGWIN, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE,
 RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL,
 TXREP autolearn=ham autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on
 server2.sourceware.org
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: <http://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: <http://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
Reply-To: cygwin@cygwin.com
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cygwin-bounces@cygwin.com
Sender: "Cygwin" <cygwin-bounces@cygwin.com>

On Jun  7 14:56, Cary Lewis via Cygwin wrote:
> Thanks very much for the reply - I will wait for Corinna's take on this as
> well - the patch shouldn't be too hard.

It's not that easy, but not too hard either:

- Windows 10 1709 and later actually support the TCP_KEEPIDLE,
  TCP_KEEPINTVL and TCP_KEEPCNT options natively, so all is fine here.

- Older OS versions require the use of a single call
  WSAIoctl(SIO_KEEPALIVE_VALS), while TCP_KEEPIDLE, TCP_KEEPINTVL and
  TCP_KEEPCNT are three distinct calls, with TCP_KEEPCNT being no-op on
  pre W10 1709.

> In fact the source code for curl in the lib/connect.c file has code to
> enable the winsock options, so hopefully that code could be helpful. I

But, here's the question:

Even if neither one of SIO_KEEPALIVE_VALS, TCP_KEEPIDLE, TCP_KEEPINTVL
and TCP_KEEPCNT are available, curl *still* uses SO_KEEPALIVE to enable
TCP keep-alive.  Given TCP keep-alive has default settings on Windows,
too (2 hours, 1 sec, 10 times), and given SO_KEEPALIVE is supported on
Cygwin as well, why isn't that sufficient?

Keep in mind that none of the above WSAIoctl/setsockopt options are
portable, only SO_KEEPALIVE is.  So why should that work on, say,
Solaris, but not on Windows?


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
--
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
