aboutsummaryrefslogtreecommitdiff
path: root/gnu
Commit message (Collapse)AuthorAge
* tests/network-size: Verify +nan.0 and +inf.0 are allowed as stddev.Maxime Devos2021-09-22
| | | | | | * tests/network-size.scm (%estimates): Add two cases. * gnu/gnunet/nse/client.scm (reconnect)[handlers]<msg:nse:estimate>{well-formed?}: Adjust XXX.
* nse/client: Allow NaN as standard deviation.Maxime Devos2021-09-22
| | | | | | | | See <https://bugs.gnunet.org/view.php?id=7021#c18399>. * doc/scheme-gnunet.tm (Estimation of the size of the network)[estimate:standard-deviation]: Document it.
* Update copyright notices.Maxime Devos2021-09-21
|
* mq-impl/stream: Remove resolved TODO.Maxime Devos2021-09-21
| | | | | * gnu/gnunet/mq-impl/stream.scm (handle-output!): Remove TODO about closing.
* README.org: Remove things documented in the manual.Maxime Devos2021-09-21
| | | | | | | | * README.org (Message queues, List of errors, Configuration, Network structures) (GNUnet network structures, network size estimation): Delete. * gnu/gnunet/mq.scm (make-message-queue): Remove reference to README.org, point to the manual instead.
* config: Automatically load defaults, system and user configuration.Maxime Devos2021-09-21
| | | | | | | | | * gnu/gnunet/config/fs.scm (locate-defaults,load-configuration): New procedures. * doc/scheme-gnunet.tm (Loading configuration files): Document new procedure. * gnu/gnunet/config/default.conf: New file. * Makefile.am (nobase_dist_guilesite_DATA): Add new file.
* config/fs: Mark TODO's as done.Maxime Devos2021-09-21
| | | | * gnu/gnunet/config/fs.scm: Remove TODO's at the top of the file.
* config: Allow expanding loaded configurations.Maxime Devos2021-09-21
| | | | | | | | | | | | | | | | * gnu/gnunet/config/fs.scm (make-expanded-configuration): New procedure. * doc/scheme-gnunet.tm (Loading configuration files): Document new procedure. * tests/config-fs.scm (load-string->config/expanded, load-string->alist/expanded): New procedures. ("make-expanded-configuration, one variable" ("make-expanded-configuration, expand variable (via getenv)") ("make-expanded-configuration, expand variable (via getenv, fancyness)") ("make-expanded-configuration, expand variable (via PATHS)") ("make-expanded-configuration, expand variable (via PATHS + getenv)") ("make-expanded-configuration, loop detected"): New tests.
* config: Implement loading a configuration file.Maxime Devos2021-09-21
| | | | | | | | | | | | | | | | | | | | | * doc/scheme-gnunet.tm (Loading configuration files): Unstub section. * gnu/gnunet/config/fs.scm (load-configuration/port!): New procedure. * tests/config-fs.scm (load-string->alist/unexpanded): New procedure. ("load-configuration/port!, literal read-value") ("load-configuration/port!, empty") ("load-configuration/port!, assignment outside section") ("load-configuration/port!, literal read-value after empty line") ("load-configuration/port!, section after empty line") ("load-configuration/port!, bogus syntax before section") ("load-configuration/port!, bogus syntax after section") ("load-configuration/port!, skip comment (#) after section") ("load-configuration/port!, skip comment (%) after section") ("load-configuration/port!, skip empty line after section") ("load-configuration/port!, skip comment (#) before section") ("load-configuration/port!, skip comment (%) before section") ("load-configuration/port!, skip empty line before section") ("load-configuration/port!, two sections"): New tests.
* config/fs: Locate the user and system configuration.Maxime Devos2021-09-21
| | | | | | | | * Makefile.am (modules): Add new module. (SCM_TESTS): Add new tests. * doc/scheme-gnunet.tm (Locating configuration files): New section. * gnu/gnunet/config/fs.scm: New module. * tests/config-fs.scm: New test file.
* nse/client: Stop reconnecting when a disconnect is requested.Maxime Devos2021-09-21
| | | | | | | | | | | * gnu/gnunet/nse/client.scm (<server>)[request-close?/box]: New field. (disconnect!): Set new box before signalling the condition. (reconnect)[error-handler]{input:regular-end-of-file,input:premature-end-of-file}: When the new box holds #t as value, don't reconnect. (connect): Adjust callers. * tests/network-size.scm ("close, connected --> all fibers stop, two callbacks called"): New test.
* nse/client: Remove default for 'spawn'.Maxime Devos2021-09-21
| | | | | | | | 'connect' always sets it, so it doesn't need to be set here as well. This also prevents accidentally calling 'spawn-fiber' to a degree. * gnu/gnunet/nse/client.scm (reconnect): Remove default for 'spawn'.
* nse/client: Remove rest arguments.Maxime Devos2021-09-21
| | | | | | | For better error handling * gnu/gnunet/nse/client.scm (connect): Remove 'rest'. Adjust call to 'reconnect'.
* nse/client: Use 'spawn' instead of hardcoding 'spawn-fiber'.Maxime Devos2021-09-21
| | | | | * gnu/gnunet/nse/client.scm (reconnect): Spawn 'request-close-handler' with 'spawn' instead of 'spawn-fiber'.
* nse/client: Report errors and reconnect.Maxime Devos2021-09-21
| | | | | | * gnu/gnunet/nse/client.scm (reconnect)[error-handler]{else}: New branch, reporting the error and closing the queue.
* mq/error-reporting: Support error reporting.Maxime Devos2021-09-21
| | | | | | | | | | | | | Some changes to nse/client will be necessary. * Makefile.am (modules): Add new module. (SCM_TESTS): Add new test. * doc/scheme-gnunet.tm (Error handler): Suggest reporting errors. (Error reporting): New section. * gnu/gnunet/mq/error-reporting.scm: New module. * tests/error-reporting.scm: New tests.
* build: Find .scmfrag files when building out-of-tree.Maxime Devos2021-09-21
| | | | | | | | | * Makefile.am (E): New variable. (nobase_dist_guilesite_DATA): Add .scmfrag files and protocols .scmgen. * gnu/gnunet/message/protocols.scm (the-library-form): Search for files in %load-path.
* nse/client: Verify positivity of estimate.Maxime Devos2021-09-21
| | | | | | | | * gnu/gnunet/nse/client.scm (estimate:logarithmic-number-peers,estimate:standard-deviation) (estimate:number-peers): Remove resolved XXX. (reconnect)[handlers]<msg:nse:estimate>{well-formed?}: Verify 'size-estimate' and 'std-deviation' fields.
* nse/client: Remove resolved TODO.Maxime Devos2021-09-21
| | | | | * gnu/gnunet/nse/client.scm (reconnect)[error-handler]: Remove TODO about reconnecting.
* nse/client: Correct type documentation of <server>.Maxime Devos2021-09-21
| | | | | * gnu/gnunet/nse/client.scm (<server>)[estimate/box]: Correct type in comment.
* nse/client: Allow disconnecting.Maxime Devos2021-09-21
| | | | | | | | | | | | | | | * gnu/gnunet/nse/client.scm (<server>)[request-close-condition]: New field (disconnect!): New procedure. (reconnect): Add 'request-close-condition' argument. (reconnect)[request-close-handler]: New procedure. (reconnect): Spawn 'request-close-handler'. (connect)[request-close-condition]: New variable. (connect): Use new variable. * tests/utils.scm: Export 'call-with-temporary-directory'. * tests/network-size.scm ("close, not connected --> all fibers stop, no callbacks called"): New test.
* doc: Document that (gnu gnunet nse client) reconnects.Maxime Devos2021-09-21
| | | | | * doc/scheme-gnunet.tm (Estimation of the size of the network): Document that the module will retry after a disconnect.
* nse/client: Prepare for auto-reconnecting.Maxime Devos2021-09-21
| | | | | | * gnu/gnunet/nse/client.scm (reconnect): Extract from ... (connect): ... here.
* nse/client: Only call 'send-start!' after 'mq' has been defined.Maxime Devos2021-09-21
| | | | | | | | | This addresses a theoretical race condition. * gnu/gnunet/nse/client.scm (connect)[mq-defined]: New variable. (connect)[error-handler]: Wait on new variable. (connect)[mq]: Signal new condition after 'mq' is defined.
* mq,mq-impl: Remove TODOs about allocating memory.Maxime Devos2021-09-21
| | | | | | | | | | | These seemed like a good idea at the time, but eliminating all OOM errors seems to be unrealistic now. * gnu/gnunet/mq-impl/stream.scm (handle-input!)[handle/message]: Remove TODO about allocating memory. * gnu/gnunet/mq.scm (inject-message!): Remove TODO about catching OOM and stack overflow errors.
* mq-impl/stream: Eliminate 'return' argument of 'handle-input!'.Maxime Devos2021-09-21
| | | | | | | | | | | | * gnu/gnunet/mq-impl/stream.scm (handle-input!): Remove 'return' argument. Return errors from 'add-from-port!' instead of injecting them. (prepare-port-message-queue)[start-reader!]: Remove #:return argument. * tests/mq-stream.scm (handle-input*): New procedure. ("messages + eof are injected in-order") ("overly small message is detected (--> stop)") ("premature eof is detected (--> stop)"): Use new procedure.
* nse/client: Remove unused fields.Maxime Devos2021-09-21
| | | | | | | * gnu/gnunet/nse/client.scm (<server>): Remove 'mq', 'config', 'connected-callback', 'disconnected-callback' and 'estimate-update-callback'. (estimate): Adjust call to constructor appropriately.
* nse/client: Add a 'disconnected' callback.Maxime Devos2021-09-21
| | | | | | | | | | | | * gnu/gnunet/nse/client.scm (connect): Add 'disconnected' optional keyword argument. Document it. (connect)[error-handler]: In case of input:regular-end-of-file and input:premature-end-of-file, call 'disconnected'. (<server>)[disconnected]: New field. * tests/network-size.scm ("notify disconnected after end-of-file, after 'connected'"): New test.
* mq-impl/stream: Handle ECONNRESET gracefully.Maxime Devos2021-09-21
| | | | | | | | | | | The otherwise failing test will be added in the next commit. * gnu/gnunet/mq-impl/stream.scm (handle-input!): Handle ECONNRESET with a input:regular-end-of-file error. (handle-input!)[return/thunked]: New procedure. (handle-input!)[return/overly-small,return/premature-eof,return/done-eof]: Thunk.
* mq-impl/stream: Allow closing queues made with connect-fibers.Maxime Devos2021-09-21
| | | | | | | | | | | | | | | | | | | | * gnu/gnunet/mq-impl/stream.scm (connect/fibers): Document new behaviour. (connect/fibers)[interrupt-condition]: New variable. (connect/fibers)[close*!]: New procedure. (connect/fibers)[mq]: Use new procedure. (connect/fibers)[allow-interrupt-operation]: New variable. (connect/fibers)[sleep*]: New procedure. (connect/fibers): Pass new 'sleep*' procedure to 'connect-unix'. (connect/fibers): Inject 'connection:interrupted' if appropriate instead of 'connection:connected'. (connect-unix): Add 'sleep' argument. * doc/scheme-gnunet.tm (Disconnecting): New section. * tests/mq-stream.scm ("can close while still connecting (--> interrupted)") ("can close after being connected (--> regular-end-of-file)"): New tests. * README.org (List of errors): Note existence of 'connectin:interrupted'.
* mq-impl/stream: Allow closing the queue on request.Maxime Devos2021-09-21
| | | | | | | | | | | | | | | | | | | | | | | * gnu/gnunet/mq.scm (make-message-queue): Accept optional 'closer' argument. (close-queue!): New procedure. * gnu/gnunet/mq-impl/stream.scm (prepare-port-message-queue): Remove fixed TODO. Also return 'close!'. (prepare-port-message-queue)[request-close-condition]: New variable. (prepare-port-message-queue)[start-reader!]{wait-op}: Wait on request-close-condition and escape. (prepare-port-message-queue)[close!]: New procedure. (port->message-queue): Accept 'close!' from 'prepare-port-message-queue'. Pass it to the message queue constructor. (connect/fibers): Accept 'close!' from 'prepare-port-message-queue'. Pass it to 'make-message-queue'. Note a TODO. * tests/mq-stream.scm ("fibers stop and port closed after close! (directly after creation)") ("fibers stop and port closed after close! (some times passes)"): New tests.
* mq-impl/stream: Close the port when stopping the fibers.Maxime Devos2021-09-21
| | | | | | | | | | | | | | | | | * gnu/gnunet/mq-impl/stream.scm (prepare-port-message-queue)[closed-condition]: Document new uses. (prepare-port-message-queue)[start-reader!]: Close port if signal-condition! returns #false. (prepare-port-message-queue)[start-writer!]: Likewise. * tests/mq-stream.scm (%false-if-broken-pipe): New procedure. (false-if-broken-pipe): New macro. ("closed for writing --> handle-input! stops (port->message-queue)"): Adjust test to resource leak fix. (error-handler/regular): New procedure. ("port is closed at input eof") ("port is closed at output eof") ("port is closed at input/output eof"): New tests.
* mq: Remove TODOs about hypothetical &malformed-message.Maxime Devos2021-09-21
| | | | | | | It doesn't seem like these TODOs are going to happen. * gnu/gnunet/mq.scm (&missing-header-error, &size-mismatch-error): Remove TODOs.
* mq: Inject errors when message verification has negative result.Maxime Devos2021-09-21
| | | | | | | | * README.org (List of errors): Document logic:ill-formed. * doc/scheme-gnunet.tm (logic:ill-formed): New explanation. * gnu/gnunet/mq.scm (inject-message!): Document logic:ill-formed error. Inject that error when the verificator returns falsehood. * tests/mq.scm ("ill-formed message error"): New test.
* mq,doc: Update TODOs about message queues.Maxime Devos2021-09-21
| | | | | | | It's pretty usable now, though there's still some stuff to do. * README.org (Message queues): Remove TODOs. * gnu/gnunet/mq.scm: Remove TODOs. Add TODO about closing ports.
* mq-impl/stream: Handle closed ports more gracefully.Maxime Devos2021-09-21
| | | | | * gnu/gnunet/mq-impl/stream.scm (connect/fibers): Use 'prepare-port-message-queue'.
* mq-impl/stream: Delay knowing the port.Maxime Devos2021-09-21
| | | | | | | | * gnu/gnunet/mq-impl/stream.scm (prepare-port-message-queue): Remove 'port' argument. (prepare-port-message-queue)[start-reader!,start-writer!]: Add 'port' argument' (port->message-queue): Adjust caller.
* mq-impl/stream: Extract code to be shared with connect/fibers.Maxime Devos2021-09-21
| | | | | | * gnu/gnunet/mq-impl/stream.scm (port->message-queue): Extract most code to ... (prepare-port-message-queue): ... this new procedure.
* mq-impl/stream: Create the message queue as late as possible.Maxime Devos2021-09-21
| | | | | | | | | | This will make it simple to unify connect/fibers and port->message-queue. * gnu/gnunet/mq-impl/stream.scm (port->message-queue)[start-reader!,start-writer!]: Add 'mq' argument. (port->message-queue)[mq]: Construct it just before calling 'spawn'.
* mq-impl/stream: Name the reader and writer thunks.Maxime Devos2021-09-21
| | | | | | | | | | This makes writing changelog entries simpler, and will be useful for unifying connect/fibers and port->message-queue. * gnu/gnunet/mq-impl/stream.scm (port->message-queue)[start-reader!,start-writer!]: Move arguments of 'spawn' to a named variable.
* mq: Inject errors if no appropriate message handler exists.Maxime Devos2021-09-21
| | | | | | | | * gnu/gnunet/mq.scm (inject-message!): Inject logic:no-handler error when the handler does not exist. * tests/mq.scm ("no applicable message handler error"): New test. * README.org (List of errors): Document it. * doc/scheme-gnunet.tm (logic:no-handler): Likewise.
* nse/client: Use 'message-handler' macro.Maxime Devos2021-09-21
| | | | | * gnu/gnunet/nse/client.scm (connect)[handlers]: Use the 'message-handler' macro instead of the corresponding procedure.
* mq/handler: Define a macro for constructing handlers.Maxime Devos2021-09-21
| | | | | * gnu/gnunet/mq/handler.scm (message-handler): New macro. * doc/scheme-gnunet.tm (Message handler): Partially document it.
* mq-stream: Reuse 'type' variable instead of reading the type again.Maxime Devos2021-09-21
| | | | | | | | | This doesn't fix anything, it just makes the previous code a little less silly. * gnu/gnunet/mq.scm (inject-message!)[handler]: Use 'type' variable instead of reading the type again.
* hat-let: Allow (dotted) variable lists with <--.Maxime Devos2021-09-21
| | | | | * gnu/gnunet/utils/hat-let.scm (let^): Recognise (dotted) variable lists with <--.
* mq-impl/stream: Flush the output port regularily.Maxime Devos2021-09-21
| | | | | | * gnu/gnunet/mq-impl/stream.scm (handle-output!): Call 'force-output' after every 'send-round'. * tests/mq-stream.scm ("output buffers are flushed"): New test.
* mq-impl/stream: Document implementation pitfall.Maxime Devos2021-09-21
| | | | | * gnu/gnunet/mq-impl/stream.scm (port->message-queue): Document it in the write fiber.
* mq-impl/stream: Allow the write fiber to stop even if blocking.Maxime Devos2021-09-21
| | | | | | | | | * gnu/gnunet/mq-impl/stream.scm (port->message-queue): Interpose a 'current-write-waiter' that exits when 'closed-condition' is signalled. * tests/mq-stream.scm (call-with-spawner/wait): New procedure. ("writer blocking and closed for reading --> all fibers stop"): New test.
* mq-impl/stream: Make error injection less unobviously correct.Maxime Devos2021-09-21
| | | | | | | | This doesn't seem to fix any bug, but it does make the code seem clearer to me. * gnu/gnunet/mq-impl/stream.scm (port->message-queue): Move error injection outside 'let/ec'.
* mq-impl/stream: Stop all fibers when EOF is reached (part 2).Maxime Devos2021-09-21
| | | | | | | | | | | | | | | * gnu/gnunet/mq-impl/stream.scm (handle-input!): Allow returning errors instead of injecting them. Update documentation. (handle-output!): Detect EPIPE. (port->message-queue)[closed-condition]: Document what it is used for. (port->message-queue): Exit when the write fiber is done and the read fiber is blocking. Only inject errors if the other fiber hasn't done so already. * tests/mq-stream.scm ("closed for writing --> handle-input! stops (port->message-queue)"): New test.