src/rpc/index.js
function handleMessage (peer, msg, callback) {
    // update the peer
    dht._add(peer, (err) => {
      if (err) {
        log.error('Failed to update the kbucket store')
        log.error(err)
      }

      // get handler & exectue it
      const handler = getMessageHandler(msg.type)

      if (!handler) {
        log.error(`no handler found for message type: ${msg.type}`)
        return callback()
      }

      handler(peer, msg, callback)
    })
  }
function handleMessage (peer, msg, callback) {
    // update the peer
    dht._add(peer, (err) => {
      if (err) {
        log.error('Failed to update the kbucket store')
        log.error(err)
      }

      // get handler & exectue it
      const handler = getMessageHandler(msg.type)

      if (!handler) {
        log.error(`no handler found for message type: ${msg.type}`)
        return callback()
      }

      handler(peer, msg, callback)
    })
  }
function handleMessage ( peer , msg , callback ) { // update the peer dht . _add ( peer , ( err ) => { if ( err ) { log . error ( 'Failed to update the kbucket store' ) log . error ( err ) } // get handler & exectue it const handler = getMessageHandler ( msg . type ) if ( ! handler ) { log . error ( ` ${ msg . type } ` ) return callback ( ) } handler ( peer , msg , callback ) } ) }
Process incoming DHT messages.

@param {PeerInfo} peer
@param {Message} msg
@param {function(Error, Message)} callback
@returns {void}

@private
Process incoming DHT messages .