File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,6 +45,14 @@ abstract class BaseClient extends EventEmitter {
4545 public isDisconnected ( ) : boolean {
4646 return this . status === ClientStatus . Disconnected ;
4747 }
48+ /** Ends all connections, subscriptions, and timers for for this client. */
49+ public close ( ) {
50+ if ( this . reconnectionTimer ) {
51+ clearTimeout ( this . reconnectionTimer ) ;
52+ }
53+ this . closeSpecific ( ) ;
54+ }
55+ protected abstract closeSpecific ( ) : void ;
4856}
4957
5058export default BaseClient ;
Original file line number Diff line number Diff line change @@ -189,6 +189,9 @@ class Xud extends EventEmitter {
189189 for ( const currency in this . lndClients ) {
190190 this . lndClients [ currency ] ! . close ( ) ;
191191 }
192+ if ( ! this . raidenClient . isDisabled ( ) ) {
193+ this . raidenClient . close ( ) ;
194+ }
192195 // TODO: ensure we are not in the middle of executing any trades
193196 const closePromises : Promise < void > [ ] = [ ] ;
194197
Original file line number Diff line number Diff line change @@ -340,15 +340,11 @@ class LndClient extends BaseClient {
340340 } ) ;
341341 }
342342
343- /** Ends all subscriptions and reconnection attempts . */
344- public close = ( ) => {
343+ /** Lnd client specific cleanup . */
344+ protected closeSpecific = ( ) => {
345345 if ( this . invoiceSubscription ) {
346346 this . invoiceSubscription . cancel ( ) ;
347347 }
348-
349- if ( this . reconnectionTimer ) {
350- clearTimeout ( this . reconnectionTimer ) ;
351- }
352348 }
353349}
354350
Original file line number Diff line number Diff line change @@ -315,6 +315,9 @@ class RaidenClient extends BaseClient {
315315 const body = await parseResponseBody < { our_address : string } > ( res ) ;
316316 return body . our_address ;
317317 }
318+
319+ /** Raiden client specific cleanup. */
320+ protected closeSpecific ( ) { }
318321}
319322
320323export default RaidenClient ;
You can’t perform that action at this time.
0 commit comments