Skip to content

Commit

Permalink
rename to onerror
Browse files Browse the repository at this point in the history
  • Loading branch information
mafintosh authored Jul 24, 2024
1 parent 03a76f7 commit 5ddad94
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ module.exports = class Hyperswarm extends EventEmitter {
this._clientConnections++
let opened = false

const maybeForceRelayNext = (err) => {
const onerror = (err) => {
if (this.relayThrough && shouldForceRelaying(err.code)) {
peerInfo.forceRelaying = true
// Reset the attempts in order to fast connect to relay
Expand All @@ -196,15 +196,15 @@ module.exports = class Hyperswarm extends EventEmitter {
}

// Removed once a connection is opened
conn.on('error', maybeForceRelayNext)
conn.on('error', onerror)

conn.on('open', () => {
opened = true
this.stats.connects.client.opened++

this._connectDone()
this.connections.add(conn)
conn.removeListener('error', maybeForceRelayNext)
conn.removeListener('error', onerror)
peerInfo._connected()
peerInfo.client = true
this.emit('connection', conn, peerInfo)
Expand Down

0 comments on commit 5ddad94

Please sign in to comment.