@@ -67,7 +67,7 @@ type Box2Fn<I, J, O> = Box<dyn Fn(I, J) -> O + Send + Sync + 'static>;
67
67
68
68
type Subscriptions < C > = Arc < RwLock < HashMap < u32 , C > > > ;
69
69
type OnErrorCallback =
70
- Box2Fn < Option < String > , Option < ReconnectCallback > , BoxFuture < ' static , Result < ( ) , ClientError > > > ;
70
+ Box2Fn < ClientError , Option < ReconnectCallback > , BoxFuture < ' static , Result < ( ) , ClientError > > > ;
71
71
type OnceCallback = Box < dyn FnOnce ( Response ) -> ClientResult < ( ) > + Send + Sync + ' static > ;
72
72
type SendCallback = Arc <
73
73
dyn for < ' a > Fn ( & ' a Request ) -> BoxFuture < ' a , Result < ( ) , Box < dyn Error + Send + Sync > > >
@@ -241,7 +241,7 @@ impl Client {
241
241
/// Handle an exception from the underlying transport.
242
242
pub async fn handle_error < T , U > (
243
243
& self ,
244
- message : Option < String > ,
244
+ message : ClientError ,
245
245
reconnect : Option < T > ,
246
246
) -> ClientResult < ( ) >
247
247
where
@@ -262,12 +262,14 @@ impl Client {
262
262
} ) ) ;
263
263
264
264
tasks. await . into_iter ( ) . collect :: < Result < ( ) , _ > > ( ) ?;
265
+ self . subscriptions . write ( ) . await . clear ( ) ;
266
+ self . subscriptions_once . write ( ) . await . clear ( ) ;
265
267
Ok ( ( ) )
266
268
}
267
269
268
270
pub async fn on_error < T , U , V > ( & self , on_error : T ) -> ClientResult < u32 >
269
271
where
270
- T : Fn ( Option < String > , Option < ReconnectCallback > ) -> U + Clone + Send + Sync + ' static ,
272
+ T : Fn ( ClientError , Option < ReconnectCallback > ) -> U + Clone + Send + Sync + ' static ,
271
273
U : Future < Output = V > + Send + ' static ,
272
274
V : Into < Result < ( ) , ClientError > > + Sync + ' static ,
273
275
{
0 commit comments