func NewConsensusHandler(coord peer.MessageHandlerCoordinator,
	stream peer.ChatStream, initiatedStream bool,
	next peer.MessageHandler) (peer.MessageHandler, error) {
	handler := &ConsensusHandler{
		coordinator: coord,
		peerHandler: next,
	}

	var err error
	handler.peerHandler, err = peer.NewPeerHandler(coord, stream, initiatedStream, nil)
	if err != nil {
		return nil, fmt.Errorf("Error creating PeerHandler: %s", err)
	}

	consensusQueueSize := viper.GetInt("peer.validator.consensus.buffersize")

	if consensusQueueSize <= 0 {
		logger.Error("peer.validator.consensus.buffersize is set to %d, but this must be a positive integer, defaulting to %d", consensusQueueSize, DefaultConsensusQueueSize)
		consensusQueueSize = DefaultConsensusQueueSize
	}

	pe, _ := handler.peerHandler.To()

	handler.consenterChan = make(chan *util.Message, consensusQueueSize)
	getEngineImpl().consensusFan.RegisterChannel(pe.ID, handler.consenterChan)

	return handler, nil
}
// NewConsensusHandler constructs a new MessageHandler for the plugin.
// Is instance of peer.HandlerFactory
NewConsensusHandler constructs a new MessageHandler for the plugin.
Is instance of peer.HandlerFactory
// NewConsensusHandler constructs a new MessageHandler for the plugin . // Is instance of peer . HandlerFactory
func NewConsensusHandler(coord peer.MessageHandlerCoordinator,
	stream peer.ChatStream, initiatedStream bool,
	next peer.MessageHandler) (peer.MessageHandler, error) {
	handler := &ConsensusHandler{
		coordinator: coord,
		peerHandler: next,
	}
	var err error
	handler.peerHandler, err = peer.NewPeerHandler(coord, stream, initiatedStream, nil)
	if err != nil {
		return nil, fmt.Errorf("Error creating PeerHandler: %s", err)
	}
	consensusQueueSize := viper.GetInt("peer.validator.consensus.buffersize")
	if consensusQueueSize <= 0 {
		logger.Error("peer.validator.consensus.buffersize is set to %d, but this must be a positive integer, defaulting to %d", consensusQueueSize, DefaultConsensusQueueSize)
		consensusQueueSize = DefaultConsensusQueueSize
	}
	pe, _ := handler.peerHandler.To()
	handler.consenterChan = make(chan *util.Message, consensusQueueSize)
	getEngineImpl().consensusFan.RegisterChannel(pe.ID, handler.consenterChan)
	return handler, nil
}
func NewConsensusHandler ( coord peer . MessageHandlerCoordinator , stream peer . ChatStream , initiatedStream bool , next peer . MessageHandler ) ( peer . MessageHandler , error ) { handler := & ConsensusHandler { coordinator : coord , peerHandler : next , } var err error handler . peerHandler , err = peer . NewPeerHandler ( coord , stream , initiatedStream , nil ) if err != nil { return nil , fmt . Errorf ( " " , err ) } consensusQueueSize := viper . GetInt ( " " ) if consensusQueueSize <= 0 { logger . Error ( " " , consensusQueueSize , DefaultConsensusQueueSize ) consensusQueueSize = DefaultConsensusQueueSize } pe , _ := handler . peerHandler . To ( ) handler . consenterChan = make ( chan * util . Message , consensusQueueSize ) getEngineImpl ( ) . consensusFan . RegisterChannel ( pe . ID , handler . consenterChan ) return handler , nil }
NewConsensusHandler constructs a new MessageHandler for the plugin.
NewConsensusHandler constructs a new MessageHandler for the plugin .