@dashevo/abci
Advanced tools
Comparing version 0.18.0 to 0.18.2
@@ -0,1 +1,24 @@ | ||
## [0.18.2](https://github.com/tendermint/js-abci/compare/v0.17.0...v0.18.2) (2021-02-15) | ||
### Features | ||
* handle write or close errors ([6d5bfd3](https://github.com/tendermint/js-abci/commit/6d5bfd3d44d205007a3e9e0f20246d3d06759bdc)) | ||
## [0.18.1](https://github.com/tendermint/js-abci/compare/v0.17.0...v0.18.1) (2021-02-15) | ||
### Bug Fixes | ||
* an error on `maybeReadNextMessage` breaks server ([bca69da](https://github.com/tendermint/js-abci/commit/bca69da512e9fcf8073e7957090f236db6e3c9e2)) | ||
### Features | ||
* write error on connection error ([f94bbf5](https://github.com/tendermint/js-abci/commit/f94bbf578fd9219ef15575d1470e85bc45938543)) | ||
# [0.18.0](https://github.com/tendermint/js-abci/compare/v0.17.0...v0.18.0) (2021-02-04) | ||
@@ -2,0 +25,0 @@ |
{ | ||
"name": "@dashevo/abci", | ||
"version": "0.18.0", | ||
"version": "0.18.2", | ||
"description": "Tenderdash ABCI server", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -25,3 +25,14 @@ 'use strict' | ||
error (err) { | ||
this.close() | ||
debug('Connection error:', err) | ||
try { | ||
this.write({ | ||
exception: { error: err.toString() } | ||
}) | ||
this.close() | ||
} catch (e) { | ||
debug('Can\'t write error or close connection:', e) | ||
} | ||
this.emit('error', err) | ||
@@ -32,4 +43,12 @@ } | ||
this.recvBuf.append(data) | ||
if (this.waiting) return | ||
this.maybeReadNextMessage() | ||
try { | ||
this.maybeReadNextMessage() | ||
} catch (e) { | ||
e.recvBuf = this.recvBuf.toString('hex') | ||
this.error(e) | ||
} | ||
} | ||
@@ -39,4 +58,5 @@ | ||
let length = varint.decode(this.recvBuf.slice(0, 8)) >> 1 | ||
let lengthLength = varint.decode.bytes | ||
let messageLength = varint.decode.bytes | ||
if (length > MAX_MESSAGE_SIZE) { | ||
@@ -47,3 +67,3 @@ this.error(Error('message is longer than maximum size')) | ||
if (lengthLength + length > this.recvBuf.length) { | ||
if (messageLength + length > this.recvBuf.length) { | ||
// buffering message, don't read yet | ||
@@ -54,7 +74,8 @@ return | ||
let messageBytes = this.recvBuf.slice( | ||
lengthLength, | ||
lengthLength + length | ||
messageLength, | ||
messageLength + length | ||
) | ||
this.recvBuf.consume(lengthLength + length) | ||
this.recvBuf.consume(messageLength + length) | ||
let message = Request.decode(messageBytes) | ||
@@ -61,0 +82,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1847837
33837