few es6 sugar

This commit is contained in:
Jimmy Wärting 2018-10-02 18:37:46 +02:00
parent 502b11fb9e
commit 7df1bdfa3f

View File

@ -1,4 +1,4 @@
const Buffer = require('safe-buffer').Buffer const { Buffer } = require('safe-buffer')
const bencode = require('bencode') const bencode = require('bencode')
const debug = require('debug')('bittorrent-tracker:server') const debug = require('debug')('bittorrent-tracker:server')
const dgram = require('dgram') const dgram = require('dgram')
@ -272,8 +272,7 @@ class Server extends EventEmitter {
} }
_onError (err) { _onError (err) {
const self = this this.emit('error', err)
self.emit('error', err)
} }
listen (...args) /* port, hostname, onlistening */{ listen (...args) /* port, hostname, onlistening */{
@ -426,8 +425,7 @@ class Server extends EventEmitter {
}) })
} }
onWebSocketConnection (socket, opts) { onWebSocketConnection (socket, opts = {}) {
if (!opts) opts = {}
opts.trustProxy = opts.trustProxy || this._trustProxy opts.trustProxy = opts.trustProxy || this._trustProxy
socket.peerId = null // as hex socket.peerId = null // as hex