Skip to content

Commit

Permalink
[FAB-7955] Deliver req. unexpectedly fails
Browse files Browse the repository at this point in the history
Deliver requests unexpectedly fail when the authentication timewindow
is not set. This CR adds a default value of 15 minutes for the time
window to ensure that the deliver server does not default to 0 seconds.

Change-Id: I3332f2df8a868f7e7ea10de68329ce6c244efe46
Signed-off-by: Will Lahti <wtlahti@us.ibm.com>
  • Loading branch information
wlahti committed Jan 29, 2018
1 parent b23f581 commit e0ba763
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 8 additions & 2 deletions core/peer/deliverevents.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package peer

import (
"runtime/debug"
"time"

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/common/deliver"
Expand Down Expand Up @@ -127,10 +128,15 @@ func (s *server) Deliver(srv peer.Deliver_DeliverServer) error {
return s.dh.Handle(deliver.NewDeliverServer(srvSupport, s.policyCheckerProvider(resources.BLOCKEVENT), s.sendProducer(srv)))
}

// NewDeliverEventsServer creates an peer.Deliver server to take to deliver block and filtered block events
// NewDeliverEventsServer creates a peer.Deliver server to deliver block and
// filtered block events
func NewDeliverEventsServer(mutualTLS bool, policyCheckerProvider PolicyCheckerProvider, supportManager deliver.SupportManager) peer.DeliverServer {
timeWindow := viper.GetDuration("peer.authentication.timewindow")

if timeWindow == 0*time.Minute {
defaultTimeWindow := 15 * time.Minute
logger.Warningf("`peer.authentication.timewindow` not set; defaulting to %s", defaultTimeWindow)
timeWindow = defaultTimeWindow
}
return &server{
dh: deliver.NewHandlerImpl(supportManager, timeWindow, mutualTLS),
policyCheckerProvider: policyCheckerProvider,
Expand Down
4 changes: 4 additions & 0 deletions orderer/common/localconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,10 @@ func (c *TopLevel) completeInitialization(configDir string) {
logger.Infof("General.LocalMSPID unset, setting to %s", defaults.General.LocalMSPID)
c.General.LocalMSPID = defaults.General.LocalMSPID

case c.General.Authentication.TimeWindow == 0*time.Minute:
logger.Infof("General.Authentication.TimeWindow unset, setting to %s", defaults.General.Authentication.TimeWindow)
c.General.Authentication.TimeWindow = defaults.General.Authentication.TimeWindow

case c.FileLedger.Prefix == "":
logger.Infof("FileLedger.Prefix unset, setting to %s", defaults.FileLedger.Prefix)
c.FileLedger.Prefix = defaults.FileLedger.Prefix
Expand Down

0 comments on commit e0ba763

Please sign in to comment.