File tree Expand file tree Collapse file tree 16 files changed +59
-239
lines changed Expand file tree Collapse file tree 16 files changed +59
-239
lines changed Original file line number Diff line number Diff line change 4848### Fixed
4949
5050* nostr: fix NIP-47 ` list_transactions ` response deserialization ([ Yuki Kishimoto] and [ lnbc1QWFyb24] )
51+ * pool: fix shutdown notification sent to external channel on ` Relay::terminate ` method call ([ Yuki Kishimoto] )
5152* js: fix "RuntimeError: memory access out of bounds" WASM error ([ Yuki Kishimoto] )
5253
5354### Removed
5455
56+ * pool: remove ` RelayPoolNotification::Stop ` ([ Yuki Kishimoto] )
57+ * pool: remove ` RelayStatus::Stop ` ([ Yuki Kishimoto] )
58+ * Remove all ` start ` and ` stop ` methods ([ Yuki Kishimoto] )
59+
5560## [ v0.32.0]
5661
5762### Summary
Original file line number Diff line number Diff line change @@ -134,14 +134,6 @@ impl Client {
134134 . await
135135 }
136136
137- pub async fn start ( & self ) {
138- self . inner . start ( ) . await
139- }
140-
141- pub async fn stop ( & self ) -> Result < ( ) > {
142- Ok ( self . inner . stop ( ) . await ?)
143- }
144-
145137 pub async fn shutdown ( & self ) -> Result < ( ) > {
146138 Ok ( self . inner . clone ( ) . shutdown ( ) . await ?)
147139 }
Original file line number Diff line number Diff line change @@ -45,21 +45,6 @@ impl RelayPool {
4545 }
4646 }
4747
48- /// Start
49- ///
50- /// Internally call `connect` without wait for connection.
51- #[ inline]
52- pub async fn start ( & self ) {
53- self . inner . start ( ) . await
54- }
55-
56- /// Stop
57- ///
58- /// Call `connect` to re-start relays connections
59- pub async fn stop ( & self ) -> Result < ( ) > {
60- Ok ( self . inner . stop ( ) . await ?)
61- }
62-
6348 /// Completely shutdown pool
6449 pub async fn shutdown ( & self ) -> Result < ( ) > {
6550 Ok ( self . inner . clone ( ) . shutdown ( ) . await ?)
Original file line number Diff line number Diff line change @@ -154,11 +154,6 @@ impl Relay {
154154 self . inner . connect ( connection_timeout) . await
155155 }
156156
157- /// Disconnect from relay and set status to 'Stopped'
158- pub async fn stop ( & self ) -> Result < ( ) > {
159- Ok ( self . inner . stop ( ) . await ?)
160- }
161-
162157 /// Disconnect from relay and set status to 'Terminated'
163158 pub async fn terminate ( & self ) -> Result < ( ) > {
164159 Ok ( self . inner . terminate ( ) . await ?)
Original file line number Diff line number Diff line change @@ -16,8 +16,6 @@ pub enum RelayStatus {
1616 Connected ,
1717 /// Relay disconnected, will retry to connect again
1818 Disconnected ,
19- /// Stop
20- Stopped ,
2119 /// Relay completely disconnected
2220 Terminated ,
2321}
@@ -30,7 +28,6 @@ impl From<nostr_sdk::RelayStatus> for RelayStatus {
3028 nostr_sdk:: RelayStatus :: Connecting => Self :: Connecting ,
3129 nostr_sdk:: RelayStatus :: Connected => Self :: Connected ,
3230 nostr_sdk:: RelayStatus :: Disconnected => Self :: Disconnected ,
33- nostr_sdk:: RelayStatus :: Stopped => Self :: Stopped ,
3431 nostr_sdk:: RelayStatus :: Terminated => Self :: Terminated ,
3532 }
3633 }
Original file line number Diff line number Diff line change @@ -47,22 +47,6 @@ impl JsRelayPool {
4747 }
4848 }
4949
50- /// Start
51- ///
52- /// Internally call `connect` without wait for connection.
53- #[ wasm_bindgen]
54- pub async fn start ( & self ) {
55- self . inner . start ( ) . await
56- }
57-
58- /// Stop
59- ///
60- /// Call `connect` or `start` to re-start relays connections
61- #[ wasm_bindgen]
62- pub async fn stop ( & self ) -> Result < ( ) > {
63- self . inner . stop ( ) . await . map_err ( into_err)
64- }
65-
6650 /// Completely shutdown pool
6751 #[ wasm_bindgen]
6852 pub async fn shutdown ( & self ) -> Result < ( ) > {
Original file line number Diff line number Diff line change @@ -54,8 +54,6 @@ pub enum JsRelayStatus {
5454 Connected ,
5555 /// Relay disconnected, will retry to connect again
5656 Disconnected ,
57- /// Stop
58- Stopped ,
5957 /// Relay completely disconnected
6058 Terminated ,
6159}
@@ -68,7 +66,6 @@ impl From<RelayStatus> for JsRelayStatus {
6866 RelayStatus :: Connecting => Self :: Connecting ,
6967 RelayStatus :: Connected => Self :: Connected ,
7068 RelayStatus :: Disconnected => Self :: Disconnected ,
71- RelayStatus :: Stopped => Self :: Stopped ,
7269 RelayStatus :: Terminated => Self :: Terminated ,
7370 }
7471 }
@@ -133,11 +130,6 @@ impl JsRelay {
133130 self . inner . connect ( connection_timeout. map ( |d| * d) ) . await
134131 }
135132
136- /// Disconnect from relay and set status to 'Stopped'
137- pub async fn stop ( & self ) -> Result < ( ) > {
138- self . inner . stop ( ) . await . map_err ( into_err)
139- }
140-
141133 /// Disconnect from relay and set status to 'Terminated'
142134 pub async fn terminate ( & self ) -> Result < ( ) > {
143135 self . inner . terminate ( ) . await . map_err ( into_err)
Original file line number Diff line number Diff line change @@ -65,17 +65,6 @@ impl InternalRelayPool {
6565 }
6666 }
6767
68- pub async fn stop ( & self ) -> Result < ( ) , Error > {
69- let relays = self . relays ( ) . await ;
70- for relay in relays. values ( ) {
71- relay. stop ( ) . await ?;
72- }
73- if let Err ( e) = self . notification_sender . send ( RelayPoolNotification :: Stop ) {
74- tracing:: error!( "Impossible to send STOP notification: {e}" ) ;
75- }
76- Ok ( ( ) )
77- }
78-
7968 pub async fn shutdown ( & self ) -> Result < ( ) , Error > {
8069 // Disconnect all relays
8170 self . disconnect ( ) . await ?;
Original file line number Diff line number Diff line change @@ -56,8 +56,6 @@ pub enum RelayPoolNotification {
5656 /// Relay Status
5757 status : RelayStatus ,
5858 } ,
59- /// Stop
60- Stop ,
6159 /// Shutdown
6260 Shutdown ,
6361}
@@ -101,22 +99,6 @@ impl RelayPool {
10199 }
102100 }
103101
104- /// Start
105- ///
106- /// Internally call `connect` without wait for connection.
107- #[ inline]
108- pub async fn start ( & self ) {
109- self . inner . connect ( None ) . await
110- }
111-
112- /// Stop
113- ///
114- /// Call `connect` to re-start relays connections
115- #[ inline]
116- pub async fn stop ( & self ) -> Result < ( ) , Error > {
117- self . inner . stop ( ) . await
118- }
119-
120102 /// Completely shutdown pool
121103 #[ inline]
122104 pub async fn shutdown ( self ) -> Result < ( ) , Error > {
@@ -516,12 +498,11 @@ impl RelayPool {
516498 {
517499 let mut notifications = self . notifications ( ) ;
518500 while let Ok ( notification) = notifications. recv ( ) . await {
519- let stop: bool = RelayPoolNotification :: Stop == notification;
520501 let shutdown: bool = RelayPoolNotification :: Shutdown == notification;
521502 let exit: bool = func ( notification)
522503 . await
523504 . map_err ( |e| Error :: Handler ( e. to_string ( ) ) ) ?;
524- if exit || stop || shutdown {
505+ if exit || shutdown {
525506 break ;
526507 }
527508 }
You can’t perform that action at this time.
0 commit comments