removed net from ipcprovider (fixed #270), nicer errroTimeout in ipcprovider

This commit is contained in:
debris 2015-08-06 18:07:02 +02:00
parent a40deb4635
commit 0fdfb0724c
6 changed files with 43 additions and 22 deletions

19
dist/web3-light.js vendored
View File

@ -4069,16 +4069,23 @@ module.exports = ICAP;
var utils = require('../utils/utils');
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 _this = this;
this.responseCallbacks = {};
this.path = path;
net = net || require('net');
this.connection = net.connect({path: this.path});
this.connection.on('error', function(e){
@ -4195,7 +4202,7 @@ Timeout all requests when the end/error event is fired
IpcProvider.prototype._timeout = function() {
for(var key in this.responseCallbacks) {
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];
}
}
@ -4254,7 +4261,7 @@ IpcProvider.prototype.sendAsync = function (payload, callback) {
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.

File diff suppressed because one or more lines are too long

19
dist/web3.js vendored
View File

@ -4069,16 +4069,23 @@ module.exports = ICAP;
var utils = require('../utils/utils');
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 _this = this;
this.responseCallbacks = {};
this.path = path;
net = net || require('net');
this.connection = net.connect({path: this.path});
this.connection.on('error', function(e){
@ -4195,7 +4202,7 @@ Timeout all requests when the end/error event is fired
IpcProvider.prototype._timeout = function() {
for(var key in this.responseCallbacks) {
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];
}
}
@ -4254,7 +4261,7 @@ IpcProvider.prototype.sendAsync = function (payload, callback) {
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.

4
dist/web3.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/web3.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -25,16 +25,23 @@
var utils = require('../utils/utils');
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 _this = this;
this.responseCallbacks = {};
this.path = path;
net = net || require('net');
this.connection = net.connect({path: this.path});
this.connection.on('error', function(e){
@ -151,7 +158,7 @@ Timeout all requests when the end/error event is fired
IpcProvider.prototype._timeout = function() {
for(var key in this.responseCallbacks) {
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];
}
}