How to use the fabric-common.Utils.checkAndAddConfigSetting function in fabric-common

To help you get started, we’ve selected a few fabric-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperledger / fabric-sdk-node / fabric-client / lib / ChannelEventHub.js View on Github external
this._checkReplay(request, true);

		this._connect_running = true;
		this._current_stream++;
		const stream_id = this._current_stream;
		logger.debug('_connect - start stream:', stream_id);
		const self = this; // for callback context
		const connection_setup_timeout = setTimeout(() => {
			logger.error('_connect - timed out after:%s', self._peer._request_timeout);
			self._connect_running = false;
			self._disconnect(new Error('Unable to connect to the fabric peer service'));
		}, self._peer._request_timeout);

		// check on the keep alive options
		// the keep alive interval
		let options = utils.checkAndAddConfigSetting('grpc.keepalive_time_ms', 360000, this._peer._options);
		// how long should we wait for the keep alive response
		const request_timeout_ms = utils.getConfigSetting('request-timeout', 3000);
		options = utils.checkAndAddConfigSetting('grpc.keepalive_timeout_ms', request_timeout_ms, options);
		options = utils.checkAndAddConfigSetting('grpc.http2.min_time_between_pings_ms', five_minutes_ms, options);

		logger.debug('_connect - options %j', options);
		this._event_client = new fabprotos.protos.Deliver(this._peer._endpoint.addr, this._peer._endpoint.creds, options);
		if (this._filtered_stream) {
			this._stream = this._event_client.deliverFiltered();
		} else {
			if (this._stream_with_private_data) {
				this._stream = this._event_client.deliverWithPrivateData();
			} else {
				this._stream = this._event_client.deliver();
			}
		}
github hyperledger / fabric-sdk-node / fabric-client / lib / ChannelEventHub.js View on Github external
const stream_id = this._current_stream;
		logger.debug('_connect - start stream:', stream_id);
		const self = this; // for callback context
		const connection_setup_timeout = setTimeout(() => {
			logger.error('_connect - timed out after:%s', self._peer._request_timeout);
			self._connect_running = false;
			self._disconnect(new Error('Unable to connect to the fabric peer service'));
		}, self._peer._request_timeout);

		// check on the keep alive options
		// the keep alive interval
		let options = utils.checkAndAddConfigSetting('grpc.keepalive_time_ms', 360000, this._peer._options);
		// how long should we wait for the keep alive response
		const request_timeout_ms = utils.getConfigSetting('request-timeout', 3000);
		options = utils.checkAndAddConfigSetting('grpc.keepalive_timeout_ms', request_timeout_ms, options);
		options = utils.checkAndAddConfigSetting('grpc.http2.min_time_between_pings_ms', five_minutes_ms, options);

		logger.debug('_connect - options %j', options);
		this._event_client = new fabprotos.protos.Deliver(this._peer._endpoint.addr, this._peer._endpoint.creds, options);
		if (this._filtered_stream) {
			this._stream = this._event_client.deliverFiltered();
		} else {
			if (this._stream_with_private_data) {
				this._stream = this._event_client.deliverWithPrivateData();
			} else {
				this._stream = this._event_client.deliver();
			}
		}

		this._stream.on('data', (deliverResponse) => {
			if (self._connect_running) {
				self._connect_running = false;
github hyperledger / fabric-sdk-node / fabric-client / lib / ChannelEventHub.js View on Github external
this._current_stream++;
		const stream_id = this._current_stream;
		logger.debug('_connect - start stream:', stream_id);
		const self = this; // for callback context
		const connection_setup_timeout = setTimeout(() => {
			logger.error('_connect - timed out after:%s', self._peer._request_timeout);
			self._connect_running = false;
			self._disconnect(new Error('Unable to connect to the fabric peer service'));
		}, self._peer._request_timeout);

		// check on the keep alive options
		// the keep alive interval
		let options = utils.checkAndAddConfigSetting('grpc.keepalive_time_ms', 360000, this._peer._options);
		// how long should we wait for the keep alive response
		const request_timeout_ms = utils.getConfigSetting('request-timeout', 3000);
		options = utils.checkAndAddConfigSetting('grpc.keepalive_timeout_ms', request_timeout_ms, options);
		options = utils.checkAndAddConfigSetting('grpc.http2.min_time_between_pings_ms', five_minutes_ms, options);

		logger.debug('_connect - options %j', options);
		this._event_client = new fabprotos.protos.Deliver(this._peer._endpoint.addr, this._peer._endpoint.creds, options);
		if (this._filtered_stream) {
			this._stream = this._event_client.deliverFiltered();
		} else {
			if (this._stream_with_private_data) {
				this._stream = this._event_client.deliverWithPrivateData();
			} else {
				this._stream = this._event_client.deliver();
			}
		}

		this._stream.on('data', (deliverResponse) => {
			if (self._connect_running) {