1
1
//! Module to handle the UDP server instances.
2
- //!
3
- //! There are two main types in this module:
4
- //!
5
- //! - [`UdpServer`]: a controller to start and stop the server.
6
- //! - [`Udp`]: the server launcher.
7
- //!
8
- //! The `UdpServer` is an state machine for a given configuration. This struct
9
- //! represents concrete configuration and state. It allows to start and
10
- //! stop the server but always keeping the same configuration.
11
- //!
12
- //! The `Udp` is the server launcher. It's responsible for launching the UDP
13
- //! but without keeping any state.
14
- //!
15
- //! For the time being, the `UdpServer` is only used for testing purposes,
16
- //! because we want to be able to start and stop the server multiple times, and
17
- //! we want to know the bound address and the current state of the server.
18
- //! In production, the `Udp` launcher is used directly.
19
-
20
2
use std:: fmt:: Debug ;
21
3
22
4
use super :: RawRequest ;
@@ -37,7 +19,7 @@ pub mod states;
37
19
///
38
20
/// Some errors triggered while stopping the server are:
39
21
///
40
- /// - The [`UdpServer `] cannot send the shutdown signal to the spawned UDP service thread.
22
+ /// - The [`Server `] cannot send the shutdown signal to the spawned UDP service thread.
41
23
#[ derive( Debug ) ]
42
24
pub enum UdpError {
43
25
/// Any kind of error starting or stopping the server.
@@ -92,7 +74,7 @@ mod tests {
92
74
93
75
tokio:: time:: sleep ( Duration :: from_secs ( 1 ) ) . await ;
94
76
95
- assert_eq ! ( stopped. state. launcher . bind_to, bind_to) ;
77
+ assert_eq ! ( stopped. state. spawner . bind_to, bind_to) ;
96
78
}
97
79
98
80
#[ tokio:: test]
@@ -116,7 +98,7 @@ mod tests {
116
98
117
99
tokio:: time:: sleep ( Duration :: from_secs ( 1 ) ) . await ;
118
100
119
- assert_eq ! ( stopped. state. launcher . bind_to, bind_to) ;
101
+ assert_eq ! ( stopped. state. spawner . bind_to, bind_to) ;
120
102
}
121
103
}
122
104
0 commit comments