bad bufferpool. misc.
This commit is contained in:
parent
f17575f864
commit
8e81b8914d
@ -336,14 +336,14 @@ BlockDB.prototype.removeBlock = function removeBlock(hash, callback) {
|
||||
|
||||
if (address) {
|
||||
batch.put('u/a/' + address
|
||||
+ '/' + input.output.hash
|
||||
+ '/' + input.output.index,
|
||||
+ '/' + input.prevout.hash
|
||||
+ '/' + input.prevout.index,
|
||||
coinOffset);
|
||||
}
|
||||
|
||||
batch.put('u/t/'
|
||||
+ input.output.hash
|
||||
+ '/' + input.output.index,
|
||||
+ input.prevout.hash
|
||||
+ '/' + input.prevout.index,
|
||||
coinOffset);
|
||||
});
|
||||
|
||||
@ -1048,6 +1048,7 @@ BlockData.prototype.closeAsync = function closeAsync(callback) {
|
||||
};
|
||||
|
||||
BlockData.prototype._malloc = function _malloc(size) {
|
||||
return new Buffer(size);
|
||||
if (size > 500)
|
||||
return new Buffer(size);
|
||||
|
||||
@ -1063,6 +1064,7 @@ BlockData.prototype._malloc = function _malloc(size) {
|
||||
};
|
||||
|
||||
BlockData.prototype._free = function _free(buf) {
|
||||
return;
|
||||
if (this._bufferPool.used[buf.length] === buf) {
|
||||
assert(this._bufferPool[buf.length] === buf);
|
||||
delete this._bufferPool.used[buf.length];
|
||||
|
||||
@ -113,6 +113,7 @@ ChainDB.prototype.closeAsync = function closeAsync(callback) {
|
||||
};
|
||||
|
||||
ChainDB.prototype._malloc = function _malloc(size) {
|
||||
return new Buffer(size);
|
||||
if (!this._bufferPool[size])
|
||||
this._bufferPool[size] = new Buffer(size);
|
||||
|
||||
@ -125,6 +126,7 @@ ChainDB.prototype._malloc = function _malloc(size) {
|
||||
};
|
||||
|
||||
ChainDB.prototype._free = function _free(buf) {
|
||||
return;
|
||||
if (this._bufferPool.used[buf.length] === buf) {
|
||||
assert(this._bufferPool[buf.length] === buf);
|
||||
delete this._bufferPool.used[buf.length];
|
||||
|
||||
@ -1607,8 +1607,8 @@ Pool.prototype._nextBlock = function _nextBlock(peer) {
|
||||
return;
|
||||
|
||||
// item = peer._blockQueue.shift();
|
||||
item = peer._blockQueue.slice(0, 250);
|
||||
peer._blockQueue = peer._blockQueue.slice(250);
|
||||
item = peer._blockQueue.slice(0, 500);
|
||||
peer._blockQueue = peer._blockQueue.slice(500);
|
||||
|
||||
if (peer.destroyed)
|
||||
return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user