Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
fix: error was passed in duplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Jun 23, 2016
1 parent cdfd473 commit 9ac5cca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ function TCP () {
conn.emit('timeout')
})

socket.on('error', (err) => {
callback(err)
conn.emit('error', err)
})

socket.on('connect', () => {
callback(null, conn)
conn.emit('connect')
Expand Down
9 changes: 9 additions & 0 deletions test/libp2p-tcp.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,15 @@ describe('dial', () => {
conn.on('end', done)
})

it('dial to non existent listener', (done) => {
const ma = multiaddr('/ip4/127.0.0.1/tcp/8989')
const conn = tcp.dial(ma)
conn.on('error', (err) => {
expect(err).to.exist
done()
})
})

it('dial on IPv6', (done) => {
const ma = multiaddr('/ip6/::/tcp/9066')
const listener = tcp.createListener((conn) => {
Expand Down

0 comments on commit 9ac5cca

Please sign in to comment.