gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet-scheme] branch master updated (079243f -> 4e2ec50)


From: gnunet
Subject: [gnunet-scheme] branch master updated (079243f -> 4e2ec50)
Date: Wed, 23 Feb 2022 21:24:29 +0100

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

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

    from 079243f  cadet/client: Define the record type for CADET addresses.
     new df5def2  doc/cadet: Document how to compare CADET addresses.
     new 4e2ec50  server: Add missing file to VC.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 doc/cadet.tm          |  3 ++-
 gnu/gnunet/server.scm | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+), 1 deletion(-)
 create mode 100644 gnu/gnunet/server.scm

diff --git a/doc/cadet.tm b/doc/cadet.tm
index 0f2b68f..52bbad8 100644
--- a/doc/cadet.tm
+++ b/doc/cadet.tm
@@ -57,7 +57,8 @@
 
     The predicate for CADET addresses is <scm|cadet-address?>. The peer and
     port can be extracted with the accessors <scm|cadet-address-peer> and
-    <scm|cadet-address-port>.
+    <scm|cadet-address-port>. CADET addresses can be compared with
+    <scm|equal?>.
   </explain>
 
   Guile has a generic interface for network addresses, see (guile)Network
diff --git a/gnu/gnunet/server.scm b/gnu/gnunet/server.scm
new file mode 100644
index 0000000..0bd9147
--- /dev/null
+++ b/gnu/gnunet/server.scm
@@ -0,0 +1,71 @@
+;; This file is part of Scheme-GNUnet
+;; Copyright © 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
+;; by the Free Software Foundation, either version 3 of the License,
+;; or (at your option) any later version.
+;;
+;; Scheme-GNUnet is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; Affero General Public License for more details.
+;;
+;; You should have received a copy of the GNU Affero General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+;;
+;; SPDX-License-Identifier: AGPL-3.0-or-later
+
+;; TODO: document
+(define-library (gnu gnunet server)
+  (export maybe-send-control-message!* make-error-handler)
+  (import (only (rnrs base)
+               begin define case else apply values quote)
+         (only (fibers conditions)
+               wait-operation)
+         (only (fibers channels)
+               put-operation)
+         (only (fibers operations)
+               choice-operation perform-operation))
+  (begin
+    (define (maybe-send-control-message!* terminal-condition control-channel
+                                         . message)
+      "Send @var{message} to the main loop, unless it is stopping or has 
stopped.
+
+This sends a @var{message} to @var{control-channel} or waits for
+@var{terminal-condition} to be signalled, whichever happens first."
+      (perform-operation
+       (choice-operation
+       ;; Nothing to do when the <server> is permanently disconnected,
+       ;; or is being disconnected.
+       (wait-operation terminal-condition)
+       (put-operation control-channel message))))
+
+    (define (make-error-handler connected disconnected terminal-condition 
control-channel)
+      (define (error-handler key . arguments)
+       (case key
+         ((connection:connected)
+          ;; Tell the event loop to resume old requests.
+          (connected)
+          (maybe-send-control-message!* terminal-condition control-channel
+                                        'resend-old-operations!)
+          (values))
+         ((input:regular-end-of-file input:premature-end-of-file)
+          (disconnected)
+          ;; Tell the event loop that it is time to restart,
+          ;; unless it already stopping.
+          (maybe-send-control-message!* terminal-condition control-channel 
'reconnect!))
+         ;; The event loop closed the queue and will exit, nothing to do here!
+         ;;
+         ;; Tested by "(DHT) close, not connected --> all fibers stop,
+         ;; no callbacks called" in tests/distributed-hash-table.scm.
+         ((connection:interrupted)
+          (values))
+         (else
+          ;; Some unknown problem, let the event loop report the error,
+          ;; disconnect and stop reconnecting.  The first two happen
+          ;; in no particular order.
+          (apply maybe-send-control-message!* terminal-condition
+                 control-channel 'oops! key arguments)
+          (values))))
+      error-handler)))

-- 
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]