gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet-scheme] 01/04: nse/client: Simplify 'connected', 'disconnected'


From: gnunet
Subject: [gnunet-scheme] 01/04: nse/client: Simplify 'connected', 'disconnected' and 'updated'.
Date: Thu, 03 Feb 2022 13:52:31 +0100

This is an automated email from the git hooks/post-receive script.

maxime-devos pushed a commit to branch master
in repository gnunet-scheme.

commit 42446887d05a1f7899e6c95ef9ea9ae743610f23
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Thu Feb 3 11:48:11 2022 +0000

    nse/client: Simplify 'connected', 'disconnected' and 'updated'.
    
    * gnu/gnunet/nse/client.scm (connect): Let 'connected', 'updated' and
      'disconnected' be 'values' by default.
      (reconnect): Call 'connected', 'updated' and 'disconnected' 
unconditionally.
    
    Fixes: <https://notabug.org/maximed/scheme-gnunet/issues/23>.
---
 gnu/gnunet/nse/client.scm | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/gnu/gnunet/nse/client.scm b/gnu/gnunet/nse/client.scm
index 3bb1095..945e2bd 100644
--- a/gnu/gnunet/nse/client.scm
+++ b/gnu/gnunet/nse/client.scm
@@ -1,5 +1,5 @@
 ;; This file is part of scheme-GNUnet, a partial Scheme port of GNUnet.
-;; Copyright (C) 2021 GNUnet e.V.
+;; Copyright © 2021, 2022 GNUnet e.V.
 ;;
 ;; scheme-GNUnet is free software: you can redistribute it and/or modify it
 ;; under the terms of the GNU Affero General Public License as published
@@ -135,8 +135,7 @@ even if not connected.  This is an idempotent operation."
           (read% /:msg:nse:estimate '(std-deviation) estimate-slice)
           (read% /:msg:nse:estimate '(timestamp) estimate-slice)))
        (atomic-box-set! estimate/box estimate)
-       (when updated
-         (updated estimate)))
+       (updated estimate))
       (define handlers
        (message-handlers
         (message-handler
@@ -173,14 +172,14 @@ even if not connected.  This is an idempotent operation."
           ;; uses @var{mq}.
           (wait mq-defined)
           (send-start!)
-          (when connected (connected)))
+          (connected))
          ((input:regular-end-of-file input:premature-end-of-file)
           ;; Call 'reconnect' after 'disconnected'.  Otherwise,
           ;; it is possible that 'connected' is called twice without
           ;; a call to 'disconnected' in-between, which would presumably
           ;; be confusing.
           (signal-condition! mq-closed)
-          (when disconnected (disconnected))
+          (disconnected)
           ;; Don't reconnect after 'close-queue!'.  About races: it's not
           ;; paramount we stop reconnecting immediately, but we should stop
           ;; eventually after 'request-close?/box' is set and
@@ -211,8 +210,8 @@ even if not connected.  This is an idempotent operation."
       (signal-condition! mq-defined)
       (spawn request-close-handler))
 
-    (define* (connect config #:key updated connected disconnected
-                     (spawn spawn-fiber))
+    (define* (connect config #:key (updated values) (connected values)
+                     (disconnected values) (spawn spawn-fiber))
       "Connect to the NSE service in the background.
 
 When connected, the thunk @var{connected} is called and estimates

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]