Browse Source

feat: add pinner logs upon peer connection/ disconnection

develop
Ezerous 4 years ago
parent
commit
5a4523131d
  1. 1
      packages/concordia-pinner/.eslintrc.js
  2. 1
      packages/concordia-pinner/src/app.js
  3. 8
      packages/concordia-pinner/src/index.js

1
packages/concordia-pinner/.eslintrc.js

@ -44,6 +44,7 @@ module.exports = {
'no-console': 'off',
'no-shadow': 'warn',
'no-multi-str': 'warn',
'no-underscore-dangle': 0,
'jsx-a11y/label-has-associated-control': [2, {
labelAttributes: ['label'],
controlComponents: ['Input'],

1
packages/concordia-pinner/src/app.js

@ -19,7 +19,6 @@ const responseBody = {
async function getStats(orbit) {
try {
// eslint-disable-next-line no-underscore-dangle
const ipfs = orbit._ipfs;
const { id } = await ipfs.id();
const peers = await ipfs.swarm.peers();

8
packages/concordia-pinner/src/index.js

@ -84,6 +84,14 @@ const main = async () => {
topics: [eventJsonInterface.signature],
}, handleWeb3LogEvent(web3, eventJsonInterface, orbit));
orbit._ipfs.libp2p.connectionManager.on(
'peer:connect',
(peerInfo) => console.log('Peer connected: ', peerInfo.remotePeer.toB58String()),
);
orbit._ipfs.libp2p.connectionManager.on(
'peer:disconnect',
(peerInfo) => console.log('Peer disconnected: ', peerInfo.remotePeer.toB58String()),
);
startAPI(orbit);
})));
};

Loading…
Cancel
Save