From patchwork Sat Feb 13 13:47:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 27026 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 6061D27BC2E; Sat, 13 Feb 2021 13:48:49 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id F337127BC27 for ; Sat, 13 Feb 2021 13:48:48 +0000 (GMT) Received: from localhost ([::1]:45878 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAvI0-0003E3-0T for patchwork@mira.cbaines.net; Sat, 13 Feb 2021 08:48:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55200) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAvHV-0002kn-5o for guix-patches@gnu.org; Sat, 13 Feb 2021 08:48:17 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:50519) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lAvHN-00079S-Sw for guix-patches@gnu.org; Sat, 13 Feb 2021 08:48:11 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lAvHN-0002xy-3y for guix-patches@gnu.org; Sat, 13 Feb 2021 08:48:09 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#45409] [PATCH v5 10/14] substitute: Remove now redundant connection caching helpers. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 13 Feb 2021 13:48:09 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45409 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 45409@debbugs.gnu.org Received: via spool by 45409-submit@debbugs.gnu.org id=B45409.161322405011252 (code B ref 45409); Sat, 13 Feb 2021 13:48:09 +0000 Received: (at 45409) by debbugs.gnu.org; 13 Feb 2021 13:47:30 +0000 Received: from localhost ([127.0.0.1]:33811 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lAvGj-0002vK-Vi for submit@debbugs.gnu.org; Sat, 13 Feb 2021 08:47:30 -0500 Received: from mira.cbaines.net ([212.71.252.8]:48204) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lAvGd-0002tJ-2g for 45409@debbugs.gnu.org; Sat, 13 Feb 2021 08:47:24 -0500 Received: from localhost (unknown [IPv6:2a02:8010:68c1:0:8ac0:b4c7:f5c8:7caa]) by mira.cbaines.net (Postfix) with ESMTPSA id 0F47727BC4C for <45409@debbugs.gnu.org>; Sat, 13 Feb 2021 13:47:21 +0000 (GMT) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 94cae6e3 for <45409@debbugs.gnu.org>; Sat, 13 Feb 2021 13:47:19 +0000 (UTC) From: Christopher Baines Date: Sat, 13 Feb 2021 13:47:15 +0000 Message-Id: <20210213134719.19625-10-mail@cbaines.net> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210213134719.19625-1-mail@cbaines.net> References: <20210213134719.19625-1-mail@cbaines.net> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Failures now should be handled where they occur, and if there's a problem that's symptomatic of an issue with the connection, the port should be closed. * guix/scripts/substitute.scm (call-with-cached-connection): Remove procedure. (with-cached-connection): Remove syntax rule. --- guix/scripts/substitute.scm | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm index 5d4884a7db..a2b1526cc6 100755 --- a/guix/scripts/substitute.scm +++ b/guix/scripts/substitute.scm @@ -690,32 +690,6 @@ server certificates." (drain-input socket) socket)))))))) -(define* (call-with-cached-connection uri proc - #:optional - (open-connection - open-connection-for-uri/cached)) - (let ((port (open-connection uri))) - (catch #t - (lambda () - (proc port)) - (lambda (key . args) - ;; If PORT was cached and the server closed the connection in the - ;; meantime, we get EPIPE. In that case, open a fresh connection and - ;; retry. We might also get 'bad-response or a similar exception from - ;; (web response) later on, once we've sent the request, or a - ;; ERROR/INVALID-SESSION from GnuTLS. - (if (or (and (eq? key 'system-error) - (= EPIPE (system-error-errno `(,key ,@args)))) - (and (eq? key 'gnutls-error) - (eq? (first args) error/invalid-session)) - (memq key '(bad-response bad-header bad-header-component))) - (proc (open-connection uri #:fresh? #t)) - (apply throw key args)))))) - -(define-syntax-rule (with-cached-connection uri port exp ...) - "Bind PORT with EXP... to a socket connected to URI." - (call-with-cached-connection uri (lambda (port) exp ...))) - (define* (process-substitution store-item destination #:key cache-urls acl deduplicate? print-build-trace?) @@ -1011,8 +985,6 @@ default value." ;;; Local Variables: ;;; eval: (put 'with-timeout 'scheme-indent-function 1) -;;; eval: (put 'with-cached-connection 'scheme-indent-function 2) -;;; eval: (put 'call-with-cached-connection 'scheme-indent-function 1) ;;; End: ;;; substitute.scm ends here