Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Difference From ump-ng-server-0.4.0 To trunk
|
2024-11-25
| ||
| 03:05 | Fix typo. Leaf check-in: d35516997b user: jan tags: trunk | |
|
2024-09-26
| ||
| 11:37 | Move clippy config to Cargo.toml. check-in: 5cf46c3f5b user: jan tags: trunk | |
|
2024-09-10
| ||
| 18:09 | Hardcode all features for pedantic clippy in bacon config. check-in: 809e60e510 user: jan tags: trunk | |
| 01:42 | Change log update. check-in: b43ff62b5a user: jan tags: trunk, ump-ng-server-0.4.0 | |
| 01:37 | Release maintenance. check-in: b0b2b3cc65 user: jan tags: trunk | |
Changes to Cargo.toml.
| ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | + - + + + + + + + | description = "Server message dispatch loop for ump-ng." rust-version = "1.56" exclude = [ ".fossil-settings", ".efiles", ".fslckout", "www", "bacon.toml", "rustfmt.toml" ] [features] default = ["tokio"] tokio = ["dep:tokio", "dep:async-trait"] tracing = ["dep:tracing"] watchdog = ["dep:parking_lot"] [dependencies] |
Changes to bacon.toml.
1 2 3 4 5 6 7 8 9 10 11 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | - + + - + - - - - - - - - - - - - - - - - - - - - - - - - | # This is a configuration file for the bacon tool # # Bacon repository: https://github.com/Canop/bacon # Complete help on configuration: https://dystroy.org/bacon/config/ # You can also check bacon's own bacon.toml file # as an example: https://github.com/Canop/bacon/blob/main/bacon.toml # For information about clippy lints, see: # https://github.com/rust-lang/rust-clippy/blob/master/README.md #default_job = "check" |
| ︙ |
Changes to src/lib.rs.
| ︙ | |||
43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | + + + + + + + + + + + + + + + | //! has been created so it can be passed a reference to the client end-point. //! //! If the dispatch loop should terminate once all the application's client //! end-points have been dropped, then the handler can store a [`WeakClient`] //! instead (as storing a cloned [`Client`] object will preventing the dispatch //! loop from terminating due to all clients being lost). The examples in the //! [`task`] and [`thread`] modules illustrate how to do this. //! //! ## Generics //! When a new handler is created, it needs to define the generic type //! parameters: //! //! - `P` - sent from the client to the server handler for uni-directional //! messages. //! - `S` - sent from the client to the server handler when making requests. //! - `R` - replies sent back to the client from the server handler using //! [`ReplyContext::reply()`]. //! - `E` - errors returned from server handler to requestor through //! [`ReplyContext::fail()`] (and also returned by the server handler //! construction closure). //! - `RV` - return type the server handler can use to pass termination data //! back to the dispatch loop creator once it terminates. #![cfg_attr(docsrs, feature(doc_cfg))] #[cfg(feature = "watchdog")] mod wdog; #[cfg(feature = "tokio")] |
| ︙ |
Changes to src/task.rs.
| 1 2 3 4 5 6 7 8 | - + |
|
| ︙ | |||
76 77 78 79 80 81 82 83 84 85 86 87 88 89 | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | + + + |
use tokio::task::{self, JoinHandle};
use async_trait::async_trait;
use super::{channel, Client, MsgType, ReplyContext};
/// Message processing trait for an async handler.
///
/// See top module documentation for more information about [application
/// message handlers](crate#application-message-handlers).
#[async_trait]
pub trait Handler<P, S, R, E, RV> {
/// Optional initialization callback.
///
/// This is called on the dispatcher task before the main message
/// processing loop is entered.
#[allow(unused_variables)]
|
| ︙ | |||
114 115 116 117 118 119 120 121 122 | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | + + + - + + |
fn term(&mut self, rv: Option<RV>) -> Option<RV> {
rv
}
}
/// Launch a task that will process incoming messages from an ump-ng server
/// end-point.
///
/// `hbldr` is a closure that is expected to return the handler object that
/// will be responsible for processing received messages.
///
/// See top module's documentation for an overview of the [dispatch
|
| ︙ |
Changes to src/thread.rs.
| ︙ | |||
68 69 70 71 72 73 74 75 76 77 78 79 80 81 | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | + + + |
ops::ControlFlow,
thread::{self, JoinHandle}
};
use super::{channel, Client, MsgType, ReplyContext};
/// Message processing trait for a threaded handler.
///
/// See top module documentation for more information about [application
/// message handlers](crate#application-message-handlers).
pub trait Handler<P, S, R, E, RV> {
/// Optional initialization callback.
///
/// This is called on the dispatcher thread before the main message
/// processing loop is entered.
#[allow(unused_variables)]
fn init(&mut self, weak_client: ump_ng::WeakClient<P, S, R, E>) {}
|
| ︙ | |||
101 102 103 104 105 106 107 108 109 | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | + + + - + + |
fn term(&mut self, rv: Option<RV>) -> Option<RV> {
rv
}
}
/// Launch a thread that will process incoming messages from an ump-ng server
/// end-point.
///
/// `hbldr` is a closure that is expected to return the handler object that
/// will be responsible for processing received messages.
///
/// See top module's documentation for an overview of the [dispatch
|
| ︙ |