File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed
Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,14 @@ class Libp2pService {
116116 this . logger . info ( `Network ID is ${ this . config . id } , connection port is ${ port } ` ) ;
117117 }
118118
119+ async stop ( ) {
120+ if ( this . node ) {
121+ this . logger . info ( 'Stopping libp2p node...' ) ;
122+ await this . node . stop ( ) ;
123+ this . logger . info ( 'Libp2p node stopped' ) ;
124+ }
125+ }
126+
119127 async onPeerConnected ( listener ) {
120128 this . node . connectionManager . on ( 'peer:connect' , listener ) ;
121129 }
Original file line number Diff line number Diff line change @@ -11,6 +11,12 @@ class NetworkModuleManager extends BaseModuleManager {
1111 }
1212 }
1313
14+ async stop ( ) {
15+ if ( this . initialized ) {
16+ return this . getImplementation ( ) . module . stop ( ) ;
17+ }
18+ }
19+
1420 async onPeerConnected ( listener ) {
1521 if ( this . initialized ) {
1622 return this . getImplementation ( ) . module . onPeerConnected ( listener ) ;
Original file line number Diff line number Diff line change @@ -21,6 +21,12 @@ export default class MockOTNode extends OTNode {
2121 await httpClientModuleManager . close ( ) ;
2222 }
2323
24+ // Stop network module (libp2p)
25+ const networkModuleManager = this . container ?. resolve ( 'networkModuleManager' ) ;
26+ if ( networkModuleManager ?. stop ) {
27+ await networkModuleManager . stop ( ) ;
28+ }
29+
2430 // Cleanup proofing service intervals
2531 const proofingService = this . container ?. resolve ( 'proofingService' ) ;
2632 if ( proofingService ?. cleanup ) {
@@ -45,4 +51,4 @@ export default class MockOTNode extends OTNode {
4551 throw error ;
4652 }
4753 }
48- }
54+ }
You can’t perform that action at this time.
0 commit comments