From owner-freebsd-current@FreeBSD.ORG Fri May 6 05:16:41 2005 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 008DE16A4CE for ; Fri, 6 May 2005 05:16:41 +0000 (GMT) Received: from smtp.vzavenue.net (smtp.vzavenue.net [66.171.59.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 76A2A43D93 for ; Fri, 6 May 2005 05:16:40 +0000 (GMT) (envelope-from jr@opal.com) Received: from linwhf.opal.com (112.79.171.66.subscriber.vzavenue.net [66.171.79.112]) by smtp.vzavenue.net (MOS 3.4.8-GR) with ESMTP id CEF27406; Fri, 6 May 2005 00:52:38 -0400 (EDT) Received: from linwhf.opal.com (localhost [127.0.0.1]) by linwhf.opal.com (8.13.3/8.13.1) with ESMTP id j464qaUf040851 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO); Fri, 6 May 2005 00:52:36 -0400 (EDT) (envelope-from jr@linwhf.opal.com) Received: (from jr@localhost) by linwhf.opal.com (8.13.3/8.13.1/Submit) id j464qabJ040850; Fri, 6 May 2005 00:52:36 -0400 (EDT) (envelope-from jr) Date: Fri, 6 May 2005 00:52:36 -0400 From: "J.R. Oldroyd" To: "J.R. Oldroyd" Message-ID: <20050506045236.GQ51983@linwhf.opal.com> References: <20050506023318.GK51983@linwhf.opal.com> <20050505193739.Y36831@thought.holo.org> <20050506030841.GL51983@linwhf.opal.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050506030841.GL51983@linwhf.opal.com> User-Agent: Mutt/1.4.2.1i X-Junkmail-Status: score=0/50, host=smtp.vzavenue.net X-Mailman-Approved-At: Fri, 06 May 2005 12:14:30 +0000 cc: Brian Buchanan cc: freebsd-current@freebsd.org Subject: Re: async connect problem X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 May 2005 05:16:41 -0000 On May 05, 23:08, J.R. Oldroyd wrote: > On May 05, 19:39, Brian Buchanan wrote: > > On Thu, 5 May 2005, J.R. Oldroyd wrote: > > > > >Isn't our behaviour wrong... > > > > > >On 6-current, the program below prints: > > > connect: Connection refused > > > > > >Shouldn't it print: > > > connect: Operation now in progress > > > > No, that's the correct behavior. The system was able to satisfy your > > request without blocking because you were attempting a connection to the > > loopback, so connect() returned immediately with errno == ECONNREFUSED. > > > > - Brian > > You are correct, it does return EINPROGRESS when using a non-loopback > address. > Even more surprising: on further investigation, running that program with 127.0.0.1 or my own Ethernet address is inconsistent: it mostly returns ECONNREFUSED but it does return EINPROGRESS occasionally too. In several runs of 100 invocations each, I'm seeing anything from 0% to 18% of the results be EINPROGRESS - that's using the same local IP and port every time. Running it with the IP address of another host returns EINPROGRESS 100% of the time. The getsockopt() call does appear to succeed in those cases where EINPROGRESS is returned. Given the inconsistent behavior between the local and non-local addresses and the self-inconsistent behavior in the local case, it seems that we may have an issue here. -jr PS: I meant getsockopt(s, ...) before. The "f" was a typo.