Skip to content

Commit

Permalink
chore: lint issue fixed 0.30
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos authored and jacobheun committed Oct 7, 2020
1 parent 6acc84b commit 1228d1e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
28 changes: 17 additions & 11 deletions src/circuit/auto-relay.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ const hopMetadataValue = 'true'
class AutoRelay {
/**
* Creates an instance of AutoRelay.
* @constructor
*
* @class
* @param {object} props
* @param {Libp2p} props.libp2p
* @param {number} [props.maxListeners = 1] maximum number of relays to listen.
* @param {number} [props.maxListeners = 1] - maximum number of relays to listen.
*/
constructor ({ libp2p, maxListeners = 1 }) {
this._libp2p = libp2p
Expand Down Expand Up @@ -50,10 +51,11 @@ class AutoRelay {
* If the protocol is not supported, check if it was supported before and remove it as a listen relay.
* If the protocol is supported, check if the peer supports **HOP** and add it as a listener if
* inside the threshold.
*
* @param {Object} props
* @param {PeerId} props.peerId
* @param {Array<string>} props.protocols
* @return {Promise<void>}
* @returns {Promise<void>}
*/
async _onProtocolChange ({ peerId, protocols }) {
const id = peerId.toB58String()
Expand Down Expand Up @@ -92,8 +94,9 @@ class AutoRelay {

/**
* Peer disconnects.
* @param {Connection} connection connection to the peer
* @return {void}
*
* @param {Connection} connection - connection to the peer
* @returns {void}
*/
_onPeerDisconnected (connection) {
const peerId = connection.remotePeer
Expand All @@ -109,10 +112,11 @@ class AutoRelay {

/**
* Attempt to listen on the given relay connection.
*
* @private
* @param {Connection} connection connection to the peer
* @param {string} id peer identifier string
* @return {Promise<void>}
* @param {Connection} connection - connection to the peer
* @param {string} id - peer identifier string
* @returns {Promise<void>}
*/
async _addListenRelay (connection, id) {
// Check if already listening on enough relays
Expand Down Expand Up @@ -152,9 +156,10 @@ class AutoRelay {

/**
* Remove listen relay.
*
* @private
* @param {string} id peer identifier string.
* @return {void}
* @param {string} id - peer identifier string.
* @returns {void}
*/
_removeListenRelay (id) {
if (this._listenRelays.delete(id)) {
Expand All @@ -169,8 +174,9 @@ class AutoRelay {
* 1. Check the metadata store for known relays, try to listen on the ones we are already connected.
* 2. Dial and try to listen on the peers we know that support hop but are not connected.
* 3. Search the network.
*
* @param {Array<string>} [peersToIgnore]
* @return {Promise<void>}
* @returns {Promise<void>}
*/
async _listenOnAvailableHopRelays (peersToIgnore = []) {
// TODO: The peer redial issue on disconnect should be handled by connection gating
Expand Down
3 changes: 2 additions & 1 deletion src/circuit/circuit/hop.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ module.exports.hop = async function hop ({

/**
* Performs a CAN_HOP request to a relay peer, in order to understand its capabilities.
*
* @param {object} options
* @param {Connection} options.connection Connection to the relay
* @param {Connection} options.connection - Connection to the relay
* @returns {Promise<boolean>}
*/
module.exports.canHop = async function canHop ({
Expand Down
1 change: 1 addition & 0 deletions src/identify/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class IdentifyService {

/**
* Calls `push` for all peers in the `peerStore` that are connected
*
* @returns {void}
*/
pushToPeerStore () {
Expand Down
1 change: 1 addition & 0 deletions src/record/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const PeerRecord = require('./peer-record')

/**
* Create (or update if existing) self peer record and store it in the AddressBook.
*
* @param {libp2p} libp2p
* @returns {Promise<void>}
*/
Expand Down
2 changes: 1 addition & 1 deletion src/transport-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class TransportManager {
* Starts listeners for each listen Multiaddr.
*
* @async
* @param {Array<Multiaddr>} addrs addresses to attempt to listen on
* @param {Array<Multiaddr>} addrs - addresses to attempt to listen on
*/
async listen (addrs) {
if (!addrs || addrs.length === 0) {
Expand Down

0 comments on commit 1228d1e

Please sign in to comment.