mirror of
https://github.com/fluencelabs/js-libp2p-tcp
synced 2025-06-03 01:11:32 +00:00
fix: throw error on write to destroyed socket
This commit is contained in:
parent
4a86c353e0
commit
fb50de5cc6
@ -38,9 +38,8 @@ class Libp2pSocket {
|
|||||||
for await (const data of source) {
|
for await (const data of source) {
|
||||||
if (this._rawSocket.destroyed) {
|
if (this._rawSocket.destroyed) {
|
||||||
const cOpts = this._ma.toOptions()
|
const cOpts = this._ma.toOptions()
|
||||||
log('Cannot write %d bytes to destroyed socket %s:%s',
|
throw new Error('Cannot write %d bytes to destroyed socket %s:%s',
|
||||||
data.length, cOpts.host, cOpts.port)
|
data.length, cOpts.host, cOpts.port)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const flushed = this._rawSocket.write(data)
|
const flushed = this._rawSocket.write(data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user