mirror of
https://github.com/status-im/web3.js.git
synced 2025-02-22 11:08:33 +00:00
removed net from ipcprovider (fixed #270), nicer errroTimeout in ipcprovider
This commit is contained in:
parent
a40deb4635
commit
0fdfb0724c
19
dist/web3-light.js
vendored
19
dist/web3-light.js
vendored
@ -4069,16 +4069,23 @@ module.exports = ICAP;
|
|||||||
var utils = require('../utils/utils');
|
var utils = require('../utils/utils');
|
||||||
var errors = require('./errors');
|
var errors = require('./errors');
|
||||||
|
|
||||||
var errorTimeout = '{"jsonrpc": "2.0", "error": {"code": -32603, "message": "IPC Request timed out for method \'__method__\'"}, "id": "__id__"}';
|
var errorTimeout = function (method, id) {
|
||||||
|
var err = {
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"error": {
|
||||||
|
"code": -32603,
|
||||||
|
"message": "IPC Request timed out for method \'" + method + "\'"
|
||||||
|
},
|
||||||
|
"id": id
|
||||||
|
};
|
||||||
|
return JSON.stringify(err);
|
||||||
|
};
|
||||||
|
|
||||||
var IpcProvider = function (path, net) {
|
var IpcProvider = function (path, net) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
this.responseCallbacks = {};
|
this.responseCallbacks = {};
|
||||||
this.path = path;
|
this.path = path;
|
||||||
|
|
||||||
net = net || require('net');
|
|
||||||
|
|
||||||
this.connection = net.connect({path: this.path});
|
this.connection = net.connect({path: this.path});
|
||||||
|
|
||||||
this.connection.on('error', function(e){
|
this.connection.on('error', function(e){
|
||||||
@ -4195,7 +4202,7 @@ Timeout all requests when the end/error event is fired
|
|||||||
IpcProvider.prototype._timeout = function() {
|
IpcProvider.prototype._timeout = function() {
|
||||||
for(var key in this.responseCallbacks) {
|
for(var key in this.responseCallbacks) {
|
||||||
if(this.responseCallbacks.hasOwnProperty(key)){
|
if(this.responseCallbacks.hasOwnProperty(key)){
|
||||||
this.responseCallbacks[key](errorTimeout.replace('__id__', key).replace('__method__', this.responseCallbacks[key].method));
|
this.responseCallbacks[key](errorTimeout(this.responseCallbacks[key].method, key));
|
||||||
delete this.responseCallbacks[key];
|
delete this.responseCallbacks[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4254,7 +4261,7 @@ IpcProvider.prototype.sendAsync = function (payload, callback) {
|
|||||||
module.exports = IpcProvider;
|
module.exports = IpcProvider;
|
||||||
|
|
||||||
|
|
||||||
},{"../utils/utils":17,"./errors":24,"net":42}],33:[function(require,module,exports){
|
},{"../utils/utils":17,"./errors":24}],33:[function(require,module,exports){
|
||||||
/*
|
/*
|
||||||
This file is part of ethereum.js.
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
2
dist/web3-light.min.js
vendored
2
dist/web3-light.min.js
vendored
File diff suppressed because one or more lines are too long
19
dist/web3.js
vendored
19
dist/web3.js
vendored
@ -4069,16 +4069,23 @@ module.exports = ICAP;
|
|||||||
var utils = require('../utils/utils');
|
var utils = require('../utils/utils');
|
||||||
var errors = require('./errors');
|
var errors = require('./errors');
|
||||||
|
|
||||||
var errorTimeout = '{"jsonrpc": "2.0", "error": {"code": -32603, "message": "IPC Request timed out for method \'__method__\'"}, "id": "__id__"}';
|
var errorTimeout = function (method, id) {
|
||||||
|
var err = {
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"error": {
|
||||||
|
"code": -32603,
|
||||||
|
"message": "IPC Request timed out for method \'" + method + "\'"
|
||||||
|
},
|
||||||
|
"id": id
|
||||||
|
};
|
||||||
|
return JSON.stringify(err);
|
||||||
|
};
|
||||||
|
|
||||||
var IpcProvider = function (path, net) {
|
var IpcProvider = function (path, net) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
this.responseCallbacks = {};
|
this.responseCallbacks = {};
|
||||||
this.path = path;
|
this.path = path;
|
||||||
|
|
||||||
net = net || require('net');
|
|
||||||
|
|
||||||
this.connection = net.connect({path: this.path});
|
this.connection = net.connect({path: this.path});
|
||||||
|
|
||||||
this.connection.on('error', function(e){
|
this.connection.on('error', function(e){
|
||||||
@ -4195,7 +4202,7 @@ Timeout all requests when the end/error event is fired
|
|||||||
IpcProvider.prototype._timeout = function() {
|
IpcProvider.prototype._timeout = function() {
|
||||||
for(var key in this.responseCallbacks) {
|
for(var key in this.responseCallbacks) {
|
||||||
if(this.responseCallbacks.hasOwnProperty(key)){
|
if(this.responseCallbacks.hasOwnProperty(key)){
|
||||||
this.responseCallbacks[key](errorTimeout.replace('__id__', key).replace('__method__', this.responseCallbacks[key].method));
|
this.responseCallbacks[key](errorTimeout(this.responseCallbacks[key].method, key));
|
||||||
delete this.responseCallbacks[key];
|
delete this.responseCallbacks[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4254,7 +4261,7 @@ IpcProvider.prototype.sendAsync = function (payload, callback) {
|
|||||||
module.exports = IpcProvider;
|
module.exports = IpcProvider;
|
||||||
|
|
||||||
|
|
||||||
},{"../utils/utils":17,"./errors":24,"net":42}],33:[function(require,module,exports){
|
},{"../utils/utils":17,"./errors":24}],33:[function(require,module,exports){
|
||||||
/*
|
/*
|
||||||
This file is part of ethereum.js.
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
4
dist/web3.js.map
vendored
4
dist/web3.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/web3.min.js
vendored
4
dist/web3.min.js
vendored
File diff suppressed because one or more lines are too long
@ -25,16 +25,23 @@
|
|||||||
var utils = require('../utils/utils');
|
var utils = require('../utils/utils');
|
||||||
var errors = require('./errors');
|
var errors = require('./errors');
|
||||||
|
|
||||||
var errorTimeout = '{"jsonrpc": "2.0", "error": {"code": -32603, "message": "IPC Request timed out for method \'__method__\'"}, "id": "__id__"}';
|
var errorTimeout = function (method, id) {
|
||||||
|
var err = {
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"error": {
|
||||||
|
"code": -32603,
|
||||||
|
"message": "IPC Request timed out for method \'" + method + "\'"
|
||||||
|
},
|
||||||
|
"id": id
|
||||||
|
};
|
||||||
|
return JSON.stringify(err);
|
||||||
|
};
|
||||||
|
|
||||||
var IpcProvider = function (path, net) {
|
var IpcProvider = function (path, net) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
this.responseCallbacks = {};
|
this.responseCallbacks = {};
|
||||||
this.path = path;
|
this.path = path;
|
||||||
|
|
||||||
net = net || require('net');
|
|
||||||
|
|
||||||
this.connection = net.connect({path: this.path});
|
this.connection = net.connect({path: this.path});
|
||||||
|
|
||||||
this.connection.on('error', function(e){
|
this.connection.on('error', function(e){
|
||||||
@ -151,7 +158,7 @@ Timeout all requests when the end/error event is fired
|
|||||||
IpcProvider.prototype._timeout = function() {
|
IpcProvider.prototype._timeout = function() {
|
||||||
for(var key in this.responseCallbacks) {
|
for(var key in this.responseCallbacks) {
|
||||||
if(this.responseCallbacks.hasOwnProperty(key)){
|
if(this.responseCallbacks.hasOwnProperty(key)){
|
||||||
this.responseCallbacks[key](errorTimeout.replace('__id__', key).replace('__method__', this.responseCallbacks[key].method));
|
this.responseCallbacks[key](errorTimeout(this.responseCallbacks[key].method, key));
|
||||||
delete this.responseCallbacks[key];
|
delete this.responseCallbacks[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user