From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.lisp.guile.user Subject: Re: fibers on a unix socket Date: Thu, 31 Jan 2019 23:20:33 +0100 Message-ID: <20190131222033.GA30004@tuxteam.de> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ikeVEW9yuYc//A+q" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="214894"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.5.21 (2010-09-15) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Jan 31 23:21:40 2019 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gpKiK-000tpp-1H for guile-user@m.gmane.org; Thu, 31 Jan 2019 23:21:40 +0100 Original-Received: from localhost ([127.0.0.1]:33758 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gpKiF-0003Yf-Nq for guile-user@m.gmane.org; Thu, 31 Jan 2019 17:21:35 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:55240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gpKhW-0003XU-TK for guile-user@gnu.org; Thu, 31 Jan 2019 17:20:51 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gpKhT-000534-0Y for guile-user@gnu.org; Thu, 31 Jan 2019 17:20:50 -0500 Original-Received: from mail.tuxteam.de ([5.199.139.25]:50816) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gpKhQ-0004u0-Bc for guile-user@gnu.org; Thu, 31 Jan 2019 17:20:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:To:Date; bh=v5yju3GWNO/1jJjKCTdLDgv+QxFU1hVv7JV4yFAijqY=; b=uuJmjphSrnoFOGutrStN7sVatEsdvETM43L9kh7IWosQ6KH1iP3vl3A9+r9cVS/3u/kKHtmp4KxxoQmoapvHN489bGi3uNtdXouPA/gn+FzeT9kVQukr5taoZgQnTNF5AWbKMMicgSFptTQPqjHhW0aQlELx25UqW1KG0sv1wMyYgZcjxZ40gx0aih7XMMLA7gIW6Zbl+rxYQCV91DAwm2596wG3ExROSI9F1tMMwbigr2F9H92U8wrbqOlI3glIuPtKFElTX8JqFYN9kdjMPHjYmhxtGTsemRzDBdFrqMrHnNxOItv/PqLTOJEBRPMq1xpL7yyI76m/xfSq8Bhq4g==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1gpKhF-00084Q-TH for guile-user@gnu.org; Thu, 31 Jan 2019 23:20:33 +0100 Content-Disposition: inline In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 5.199.139.25 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:15276 Archived-At: --ikeVEW9yuYc//A+q Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 31, 2019 at 05:43:42PM +0100, Catonano wrote: > Hello >=20 > in Fibers there's an example of a client connecting to a server >=20 > I'd like to do the same thing BUT in my case the server provides a unix > socket. >=20 > It's a unix socket provided by Postgresql. On Ubuntu it's here > /var/run/postgresql/.s.PGSQL.5432 >=20 > I'm wondering about these 3 lines the fibers client uses >=20 > ;; Disable Nagle's algorithm. We buffer ourselves. > (setsockopt port IPPROTO_TCP TCP_NODELAY 1) The one above probably doesn't make sense for Unix domain sockets (it is specific to IP sockets and it is meant to delay sending a small packet in the hope that more stuff arrives, to avoid lots of tiny packets) > (fcntl port F_SETFL (logior O_NONBLOCK (fcntl port F_GETFL))) while this one does make sense (as Chris notes): you want your other fibres to do their happy dancing instead of blocking the whole process in the read. > (setvbuf port 'block 1024) >=20 > Can a unix socket be non blocking ? Yes, they can be both. In this respect they are not different from IP sockets. Cheers -- t --ikeVEW9yuYc//A+q Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlxTdLEACgkQBcgs9XrR2kav0ACeKE329UZUvIAvBWRDEIQDznlZ xukAniFRBGORVDiTq+vD+uTdmQiAKANv =AQG6 -----END PGP SIGNATURE----- --ikeVEW9yuYc//A+q--