constructor (client) {
    debug('create pool (port %s)', client.torrentPort)

    this._client = client

    // Temporarily store incoming connections so they can be destroyed if the server is
    // closed before the connection is passed off to a Torrent.
    this._pendingConns = new Set()

    this._onTCPConnectionBound = (conn) => {
      this._onConnection(conn, 'tcp')
    }

    this._onUTPConnectionBound = (conn) => {
      this._onConnection(conn, 'utp')
    }

    this._onListening = () => {
      this._client._onListening()
    }

    this._onTCPError = (err) => {
      this._client._destroy(err)
    }

    this._onUTPError = (err) => {
      this._client.utp = false
      this._client.emit('error', err)
      if (!this._client.listening) this._onListening()
    }

    // Setup TCP
    this.tcpServer = net.createServer()
    this.tcpServer.on('connection', this._onTCPConnectionBound)
    this.tcpServer.on('error', this._onTCPError)

    // Start TCP
    this.tcpServer.listen(client.torrentPort, () => {
      debug('creating tcpServer in port %s', this.tcpServer.address().port)
      if (this._client.utp) {
        // Setup uTP
        this.utpServer = utp.createServer()
        this.utpServer.on('connection', this._onUTPConnectionBound)
        this.utpServer.on('listening', this._onListening)
        this.utpServer.on('error', this._onUTPError)

        // Start uTP
        debug('creating utpServer in port %s', this.tcpServer.address().port)
        this.utpServer.listen(this.tcpServer.address().port)
      } else {
        this._onListening()
      }
    })
  }
Connection Pool

A connection pool allows multiple swarms to listen on the same TCP/UDP port and determines
which swarm incoming connections are intended for by inspecting the bittorrent
handshake that the remote peer sends.

@param {number} port