Skip to content

Commit

Permalink
[FAB-2843] NodeSDK - Handle network issues Part 2
Browse files Browse the repository at this point in the history
Add handling to the EventHub to be able reestablish
the connection to the peer if it finds the state
of the connection not active. Harding of the connection
setup to handle users that reuse event hubs.
Internal vars are named with the '_' and doc has been
added to explain why the error callback should be used.

Change-Id: Ibb71efdbe342e3629f9263d79b83a6fe9cb53026
Signed-off-by: Bret Harrison <beharrison@nc.rr.com>
  • Loading branch information
harrisob committed May 24, 2017
1 parent ff69ba4 commit c899119
Show file tree
Hide file tree
Showing 7 changed files with 403 additions and 178 deletions.
15 changes: 14 additions & 1 deletion fabric-client/lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var Channel = require('./Channel.js');
var ChannelConfig = require('./ChannelConfig.js');
var Packager = require('./Packager.js');
var Peer = require('./Peer.js');
var EventHub = require('./EventHub.js');
var Orderer = require('./Orderer.js');
var TransactionID = require('./TransactionID.js');
var MSP = require('./msp/msp.js');
Expand Down Expand Up @@ -205,6 +206,18 @@ var Client = class {
return peer;
}

/**
* Return a EventHub instance associated with this client instance.
* The EventHub instance must be assigned an end point address and
* connection parameters using the "setPeerAddr" method.
* @see {@link EventHub}
* @returns {EventHub} The EventHub instance
*/
newEventHub() {
var event_hub = new EventHub(this);
return event_hub;
}

/**
* Returns an order instance with the given url.
* @param {string} url The URL with format of "grpcs://host:port".
Expand Down Expand Up @@ -739,10 +752,10 @@ var Client = class {

return _getChaincodePackageData(request, this.isDevMode())
.then((data) => {
logger.debug('installChaincode data %s ',data);
// DATA may or may not be present depending on devmode settings
if (data) {
chaincodeDeploymentSpec.setCodePackage(data);
logger.debug('installChaincode - found packaged data');
}
logger.debug('installChaincode sending deployment spec %s ',chaincodeDeploymentSpec);

Expand Down
Loading

0 comments on commit c899119

Please sign in to comment.