src/sig-server/routes-ws/index.js
function updateFinger (peerId, row) {
  var availablePeers = Object.keys(peerTable)
  availablePeers.splice(availablePeers.indexOf(peerId), 1)

  // if row hasn't been checked before
  if (!peerTable[peerId].fingers[row]) {
    peerTable[peerId].fingers[row] = {
      ideal: idealFinger(new Id(peerId), row).toHex(),
      current: undefined
    }
  }

  var best = availablePeers.shift()
  availablePeers.forEach((otherId) => {
    const isFBT = fingerBestFit(
        new Id(peerId),
        new Id(peerTable[peerId].fingers[row].ideal),
        new Id(best),
        new Id(otherId))
    if (isFBT) {
      best = otherId
    }
  })
  if (best === peerTable[peerId].fingers[row].current) {
    return // nevermind then
  }
  peerTable[peerId].fingers[row].current = best
  peerTable[peerId].socket.emit('we-update-finger', {
    row: row,
    id: best
  })
}
function updateFinger (peerId, row) {
  var availablePeers = Object.keys(peerTable)
  availablePeers.splice(availablePeers.indexOf(peerId), 1)

  // if row hasn't been checked before
  if (!peerTable[peerId].fingers[row]) {
    peerTable[peerId].fingers[row] = {
      ideal: idealFinger(new Id(peerId), row).toHex(),
      current: undefined
    }
  }

  var best = availablePeers.shift()
  availablePeers.forEach((otherId) => {
    const isFBT = fingerBestFit(
        new Id(peerId),
        new Id(peerTable[peerId].fingers[row].ideal),
        new Id(best),
        new Id(otherId))
    if (isFBT) {
      best = otherId
    }
  })
  if (best === peerTable[peerId].fingers[row].current) {
    return // nevermind then
  }
  peerTable[peerId].fingers[row].current = best
  peerTable[peerId].socket.emit('we-update-finger', {
    row: row,
    id: best
  })
}
function updateFinger ( peerId , row ) { var availablePeers = Object . keys ( peerTable ) availablePeers . splice ( availablePeers . indexOf ( peerId ) , 1 ) // if row hasn't been checked before if ( ! peerTable [ peerId ] . fingers [ row ] ) { peerTable [ peerId ] . fingers [ row ] = { ideal : idealFinger ( new Id ( peerId ) , row ) . toHex ( ) , current : undefined } } var best = availablePeers . shift ( ) availablePeers . forEach ( ( otherId ) => { const isFBT = fingerBestFit ( new Id ( peerId ) , new Id ( peerTable [ peerId ] . fingers [ row ] . ideal ) , new Id ( best ) , new Id ( otherId ) ) if ( isFBT ) { best = otherId } } ) if ( best === peerTable [ peerId ] . fingers [ row ] . current ) { return // nevermind then } peerTable [ peerId ] . fingers [ row ] . current = best peerTable [ peerId ] . socket . emit ( 'we-update-finger' , { row : row , id : best } ) }
finds the best new Finger for the peerId's row 'row')
finds the best new Finger for the peerId s row row )