File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -132,7 +132,14 @@ export class GetP2PNetworkStatsHandler extends CommandHandler {
132132 const node = this . getOceanNode ( )
133133 const config = node . getConfig ( )
134134 if ( config . p2pConfig . enableNetworkStats ) {
135- const stats = node . getP2PNode ( ) . getNetworkingStats ( )
135+ const p2pNode = node . getP2PNode ( )
136+ if ( ! p2pNode ) {
137+ return {
138+ stream : null ,
139+ status : { httpStatus : 503 , error : 'P2P Interface is disabled' }
140+ }
141+ }
142+ const stats = p2pNode . getNetworkingStats ( )
136143 return {
137144 stream : Readable . from ( JSON . stringify ( stats ) ) ,
138145 status : { httpStatus : 200 }
Original file line number Diff line number Diff line change @@ -8,9 +8,9 @@ export async function p2pAnnounceDDOS(node: OceanNode) {
88 try {
99 const db = await node . getDatabase ( )
1010 const p2pNode = node . getP2PNode ( )
11- if ( ! db || ! db . ddo ) {
11+ if ( ! db || ! db . ddo || ! p2pNode ) {
1212 P2P_LOGGER . info (
13- `republishStoredDDOS() attempt aborted because there is no database!`
13+ `republishStoredDDOS() attempt aborted because there is no database or P2P is not available !`
1414 )
1515 return
1616 }
You can’t perform that action at this time.
0 commit comments