File tree 8 files changed +15
-15
lines changed
8 files changed +15
-15
lines changed Original file line number Diff line number Diff line change 32
32
* nostr: add ` identifier ` arg to NIP-51 ` EventBuilder ` set constructors ([ Yuki Kishimoto] )
33
33
* pool: use per-purpose dedicated relay channels ([ Yuki Kishimoto] )
34
34
* pool: return relay urls to which ` messages ` /` events ` have or not been sent for ` send_* ` and ` batch_* ` methods ([ Yuki Kishimoto] )
35
+ * pool: rename ` Relay::terminate ` to ` Relay::disconnect ` ([ Yuki Kishimoto] )
35
36
* ffi(sdk): convert ` RelayPool::handle_notifications ` method to async/future ([ Yuki Kishimoto] )
36
37
* js: increase max stack size to ` 0x1E84800 ` bytes (32 MiB) ([ Yuki Kishimoto] )
37
38
Original file line number Diff line number Diff line change @@ -155,8 +155,8 @@ impl Relay {
155
155
}
156
156
157
157
/// Disconnect from relay and set status to 'Terminated'
158
- pub async fn terminate ( & self ) -> Result < ( ) > {
159
- Ok ( self . inner . terminate ( ) . await ?)
158
+ pub async fn disconnect ( & self ) -> Result < ( ) > {
159
+ Ok ( self . inner . disconnect ( ) . await ?)
160
160
}
161
161
162
162
/// Send msg to relay
Original file line number Diff line number Diff line change @@ -131,8 +131,8 @@ impl JsRelay {
131
131
}
132
132
133
133
/// Disconnect from relay and set status to 'Terminated'
134
- pub async fn terminate ( & self ) -> Result < ( ) > {
135
- self . inner . terminate ( ) . await . map_err ( into_err)
134
+ pub async fn disconnect ( & self ) -> Result < ( ) > {
135
+ self . inner . disconnect ( ) . await . map_err ( into_err)
136
136
}
137
137
138
138
/// Send msg to relay
Original file line number Diff line number Diff line change @@ -182,14 +182,14 @@ impl InternalRelayPool {
182
182
let url: Url = url. try_into_url ( ) ?;
183
183
let mut relays = self . relays . write ( ) . await ;
184
184
if let Some ( relay) = relays. remove ( & url) {
185
- relay. terminate ( ) . await ?;
185
+ relay. disconnect ( ) . await ?;
186
186
}
187
187
Ok ( ( ) )
188
188
}
189
189
pub async fn remove_all_relays ( & self ) -> Result < ( ) , Error > {
190
190
let mut relays = self . relays . write ( ) . await ;
191
191
for relay in relays. values ( ) {
192
- relay. terminate ( ) . await ?;
192
+ relay. disconnect ( ) . await ?;
193
193
}
194
194
relays. clear ( ) ;
195
195
Ok ( ( ) )
@@ -692,7 +692,7 @@ impl InternalRelayPool {
692
692
pub async fn disconnect ( & self ) -> Result < ( ) , Error > {
693
693
let relays = self . relays ( ) . await ;
694
694
for relay in relays. into_values ( ) {
695
- relay. terminate ( ) . await ?;
695
+ relay. disconnect ( ) . await ?;
696
696
}
697
697
Ok ( ( ) )
698
698
}
Original file line number Diff line number Diff line change @@ -161,8 +161,8 @@ impl AtomicDestroyer for InternalRelay {
161
161
fn on_destroy ( & self ) {
162
162
let relay = self . clone ( ) ;
163
163
let _ = thread:: spawn ( async move {
164
- if let Err ( e) = relay. terminate ( ) . await {
165
- tracing:: error!( "Impossible to shutdown {} relay : {e}" , relay. url) ;
164
+ if let Err ( e) = relay. disconnect ( ) . await {
165
+ tracing:: error!( "Impossible to shutdown '{}' : {e}" , relay. url) ;
166
166
}
167
167
} ) ;
168
168
}
@@ -963,7 +963,7 @@ impl InternalRelay {
963
963
}
964
964
}
965
965
966
- pub async fn terminate ( & self ) -> Result < ( ) , Error > {
966
+ pub async fn disconnect ( & self ) -> Result < ( ) , Error > {
967
967
self . schedule_for_termination ( true ) ; // TODO: remove?
968
968
if !self . is_disconnected ( ) . await {
969
969
self . channels
Original file line number Diff line number Diff line change @@ -223,9 +223,8 @@ impl Relay {
223
223
224
224
/// Disconnect from relay and set status to 'Terminated'
225
225
#[ inline]
226
- pub async fn terminate ( & self ) -> Result < ( ) , Error > {
227
- // TODO: rename to disconnect
228
- self . inner . terminate ( ) . await
226
+ pub async fn disconnect ( & self ) -> Result < ( ) , Error > {
227
+ self . inner . disconnect ( ) . await
229
228
}
230
229
231
230
/// Send msg to relay
Original file line number Diff line number Diff line change @@ -555,7 +555,7 @@ impl Client {
555
555
pool:: Error : From < <U as TryIntoUrl >:: Err > ,
556
556
{
557
557
let relay = self . relay ( url) . await ?;
558
- relay. terminate ( ) . await ?;
558
+ relay. disconnect ( ) . await ?;
559
559
Ok ( ( ) )
560
560
}
561
561
Original file line number Diff line number Diff line change @@ -199,7 +199,7 @@ impl NWC {
199
199
200
200
/// Completely shutdown [NWC] client
201
201
pub async fn shutdown ( self ) -> Result < ( ) , Error > {
202
- Ok ( self . relay . terminate ( ) . await ?)
202
+ Ok ( self . relay . disconnect ( ) . await ?)
203
203
}
204
204
}
205
205
You can’t perform that action at this time.
0 commit comments