File tree 16 files changed +59
-239
lines changed 16 files changed +59
-239
lines changed Original file line number Diff line number Diff line change 48
48
### Fixed
49
49
50
50
* 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] )
51
52
* js: fix "RuntimeError: memory access out of bounds" WASM error ([ Yuki Kishimoto] )
52
53
53
54
### Removed
54
55
56
+ * pool: remove ` RelayPoolNotification::Stop ` ([ Yuki Kishimoto] )
57
+ * pool: remove ` RelayStatus::Stop ` ([ Yuki Kishimoto] )
58
+ * Remove all ` start ` and ` stop ` methods ([ Yuki Kishimoto] )
59
+
55
60
## [ v0.32.0]
56
61
57
62
### Summary
Original file line number Diff line number Diff line change @@ -134,14 +134,6 @@ impl Client {
134
134
. await
135
135
}
136
136
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
-
145
137
pub async fn shutdown ( & self ) -> Result < ( ) > {
146
138
Ok ( self . inner . clone ( ) . shutdown ( ) . await ?)
147
139
}
Original file line number Diff line number Diff line change @@ -45,21 +45,6 @@ impl RelayPool {
45
45
}
46
46
}
47
47
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
-
63
48
/// Completely shutdown pool
64
49
pub async fn shutdown ( & self ) -> Result < ( ) > {
65
50
Ok ( self . inner . clone ( ) . shutdown ( ) . await ?)
Original file line number Diff line number Diff line change @@ -154,11 +154,6 @@ impl Relay {
154
154
self . inner . connect ( connection_timeout) . await
155
155
}
156
156
157
- /// Disconnect from relay and set status to 'Stopped'
158
- pub async fn stop ( & self ) -> Result < ( ) > {
159
- Ok ( self . inner . stop ( ) . await ?)
160
- }
161
-
162
157
/// Disconnect from relay and set status to 'Terminated'
163
158
pub async fn terminate ( & self ) -> Result < ( ) > {
164
159
Ok ( self . inner . terminate ( ) . await ?)
Original file line number Diff line number Diff line change @@ -16,8 +16,6 @@ pub enum RelayStatus {
16
16
Connected ,
17
17
/// Relay disconnected, will retry to connect again
18
18
Disconnected ,
19
- /// Stop
20
- Stopped ,
21
19
/// Relay completely disconnected
22
20
Terminated ,
23
21
}
@@ -30,7 +28,6 @@ impl From<nostr_sdk::RelayStatus> for RelayStatus {
30
28
nostr_sdk:: RelayStatus :: Connecting => Self :: Connecting ,
31
29
nostr_sdk:: RelayStatus :: Connected => Self :: Connected ,
32
30
nostr_sdk:: RelayStatus :: Disconnected => Self :: Disconnected ,
33
- nostr_sdk:: RelayStatus :: Stopped => Self :: Stopped ,
34
31
nostr_sdk:: RelayStatus :: Terminated => Self :: Terminated ,
35
32
}
36
33
}
Original file line number Diff line number Diff line change @@ -47,22 +47,6 @@ impl JsRelayPool {
47
47
}
48
48
}
49
49
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
-
66
50
/// Completely shutdown pool
67
51
#[ wasm_bindgen]
68
52
pub async fn shutdown ( & self ) -> Result < ( ) > {
Original file line number Diff line number Diff line change @@ -54,8 +54,6 @@ pub enum JsRelayStatus {
54
54
Connected ,
55
55
/// Relay disconnected, will retry to connect again
56
56
Disconnected ,
57
- /// Stop
58
- Stopped ,
59
57
/// Relay completely disconnected
60
58
Terminated ,
61
59
}
@@ -68,7 +66,6 @@ impl From<RelayStatus> for JsRelayStatus {
68
66
RelayStatus :: Connecting => Self :: Connecting ,
69
67
RelayStatus :: Connected => Self :: Connected ,
70
68
RelayStatus :: Disconnected => Self :: Disconnected ,
71
- RelayStatus :: Stopped => Self :: Stopped ,
72
69
RelayStatus :: Terminated => Self :: Terminated ,
73
70
}
74
71
}
@@ -133,11 +130,6 @@ impl JsRelay {
133
130
self . inner . connect ( connection_timeout. map ( |d| * d) ) . await
134
131
}
135
132
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
-
141
133
/// Disconnect from relay and set status to 'Terminated'
142
134
pub async fn terminate ( & self ) -> Result < ( ) > {
143
135
self . inner . terminate ( ) . await . map_err ( into_err)
Original file line number Diff line number Diff line change @@ -65,17 +65,6 @@ impl InternalRelayPool {
65
65
}
66
66
}
67
67
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
-
79
68
pub async fn shutdown ( & self ) -> Result < ( ) , Error > {
80
69
// Disconnect all relays
81
70
self . disconnect ( ) . await ?;
Original file line number Diff line number Diff line change @@ -56,8 +56,6 @@ pub enum RelayPoolNotification {
56
56
/// Relay Status
57
57
status : RelayStatus ,
58
58
} ,
59
- /// Stop
60
- Stop ,
61
59
/// Shutdown
62
60
Shutdown ,
63
61
}
@@ -101,22 +99,6 @@ impl RelayPool {
101
99
}
102
100
}
103
101
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
-
120
102
/// Completely shutdown pool
121
103
#[ inline]
122
104
pub async fn shutdown ( self ) -> Result < ( ) , Error > {
@@ -516,12 +498,11 @@ impl RelayPool {
516
498
{
517
499
let mut notifications = self . notifications ( ) ;
518
500
while let Ok ( notification) = notifications. recv ( ) . await {
519
- let stop: bool = RelayPoolNotification :: Stop == notification;
520
501
let shutdown: bool = RelayPoolNotification :: Shutdown == notification;
521
502
let exit: bool = func ( notification)
522
503
. await
523
504
. map_err ( |e| Error :: Handler ( e. to_string ( ) ) ) ?;
524
- if exit || stop || shutdown {
505
+ if exit || shutdown {
525
506
break ;
526
507
}
527
508
}
You can’t perform that action at this time.
0 commit comments