[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet-scheme] 154/324: mq: Implement 'inject-error!'.
From: |
gnunet |
Subject: |
[gnunet-scheme] 154/324: mq: Implement 'inject-error!'. |
Date: |
Tue, 21 Sep 2021 13:23:14 +0200 |
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 75719b153f3de7059e48e71ff5032c695ee1dca1
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Sat Jul 10 18:38:19 2021 +0200
mq: Implement 'inject-error!'.
It will be tested in the test suite of the ‘stream’ implementation
of message queues.
* README.org (List of errors): Document a few error codes
to be used by the ‘stream’ implementation of message queues.
* gnu/gnunet/mq.scm (inject-error!): New procedure.
---
README.org | 20 ++++++++++++++++++++
gnu/gnunet/mq.scm | 17 ++++++++++++++---
2 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/README.org b/README.org
index ad11af7..757b965 100644
--- a/README.org
+++ b/README.org
@@ -93,6 +93,26 @@
Message queue implementations based on streams I/O can use
(gnu gnunet utils tokeniser), to split the message stream
into separate messages.
+** List of errors
+
+ Not all errors indicate something is wrong.
+
+ Input errors
+ + input:regular-end-of-file
+
+ The end-of-file was encountered and not unexpected
+ (compare with input:premature-eof).
+ + input:premature-end-of-file
+
+ The end-of-file was encountered, but unexpected.
+ More specifically, a message was being read.
+ + input:overly-small type size
+
+ The message size in the header was smaller than the minimal
+ message size.
+
+ Input errors (decoding)
+ + TODO verification failed, unknown message type
** Configuration :test:good:
+ gnu/gnunet/config/parser.scm: Parse configuration files.
+ gnu/gnunet/config/expand.scm: Perform variable expansion.
diff --git a/gnu/gnunet/mq.scm b/gnu/gnunet/mq.scm
index af2a9fd..9851d04 100644
--- a/gnu/gnunet/mq.scm
+++ b/gnu/gnunet/mq.scm
@@ -32,7 +32,7 @@
(define-library (gnu gnunet mq)
(export <message-queue> make-message-queue message-queue?
make-one-by-one-sender
- inject-message! send-message!
+ inject-message! inject-error! send-message!
message-queue-length
%message-queue-garbagitude
try-send-again!
@@ -69,7 +69,7 @@
lambda assert let begin define
procedure? eq? >= = <= < if quote
values and let* not cons car cdr
- cond + - > *)
+ cond + - > * apply)
(only (rnrs control)
when unless)
(only (rnrs conditions)
@@ -118,7 +118,8 @@ handler is the ‘message type’. Note that, unlike in the C
implementation,
messages are not serialised. As such, some synchronisation or punting
messages onto a separate thread may be necessary.
-XXX and error handler @var{error-handler}
+Injected errors are passed to @var{error-handler}, a variadic procedure.
+A list of possible errors can be found in @file{README.org}.
Messages are sent with @var{sender}. It can be created with
@code{make-one-by-one-sender}."
@@ -230,6 +231,16 @@ of message queues."
;; and stack overflow errors ...
(handle-message! handler message)))
+ (define (inject-error! mq key . rest)
+ "Inject the error @code{key . rest} in the message queue @var{mq}.
+
+This is meant to be used by the message queue implementation,
+e.g. in response to an I/O error, although in principle it can be used by
+the user of the message queue as well. Whether the message queue is still
+usable when this procedure is called, depends on the message queue
+implementation and injected error."
+ (apply (message-queue-error-handler mq) key rest))
+
(define (message-queue-length mq)
"How many messages are currently in the message queue @var{mq}?"
(pfds:queue-length
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet-scheme] 126/324: netstruct: Verify there is a setter (not a reader) in set%!., (continued)
- [gnunet-scheme] 126/324: netstruct: Verify there is a setter (not a reader) in set%!., gnunet, 2021/09/21
- [gnunet-scheme] 128/324: netstruct: Raise &unwritable, not an &unreadable, in set%!., gnunet, 2021/09/21
- [gnunet-scheme] 131/324: tests: mq: Work-around guile-fibers bug., gnunet, 2021/09/21
- [gnunet-scheme] 143/324: tests: Extract conservative-gc? in a library., gnunet, 2021/09/21
- [gnunet-scheme] 150/324: Merge branch 'master' into proper-mq, gnunet, 2021/09/21
- [gnunet-scheme] 148/324: utils: tokeniser: Split message streams into individual messages., gnunet, 2021/09/21
- [gnunet-scheme] 149/324: mq: Delete unused and obsolete message-io module., gnunet, 2021/09/21
- [gnunet-scheme] 155/324: enum: Fix compilation error on Guile 3.0.7., gnunet, 2021/09/21
- [gnunet-scheme] 160/324: enum: symbol->value: Return #f if the symbol doesn't exist., gnunet, 2021/09/21
- [gnunet-scheme] 159/324: Makefile.am: Correct file name of test., gnunet, 2021/09/21
- [gnunet-scheme] 154/324: mq: Implement 'inject-error!'.,
gnunet <=
- [gnunet-scheme] 156/324: mq-impl/stream: Implement on top of ports., gnunet, 2021/09/21
- [gnunet-scheme] 162/324: Merge branch 'proper-mq', gnunet, 2021/09/21
- [gnunet-scheme] 161/324: guix: Patch 'guile' to fix some bugs., gnunet, 2021/09/21
- [gnunet-scheme] 152/324: utils: tokeniser: Implement 'add-from-port!'., gnunet, 2021/09/21
- [gnunet-scheme] 157/324: README.org: Note Guile 3.0.7 cannot be used for compilation., gnunet, 2021/09/21
- [gnunet-scheme] 151/324: utils: tokeniser: Some extra documentation., gnunet, 2021/09/21
- [gnunet-scheme] 153/324: concurrency: repeated-conditions: New module., gnunet, 2021/09/21
- [gnunet-scheme] 158/324: mq-impl/stream: Add modules and tests to 'Makefile.am'., gnunet, 2021/09/21
- [gnunet-scheme] 167/324: README: Graduate 'Message queues' to :test:good:, gnunet, 2021/09/21
- [gnunet-scheme] 146/324: mq: envelope: Allow testing whether an envelope is cancelled., gnunet, 2021/09/21