Skip to content
This repository has been archived by the owner on Feb 12, 2019. It is now read-only.

Commit

Permalink
enable DialerTimeout for bserver (suggested by @strib)
Browse files Browse the repository at this point in the history
  • Loading branch information
songgao committed Dec 4, 2017
1 parent 14c0a0f commit 16fd06f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions libkbfs/bserver_remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func newBlockServerRemoteClientHandler(name string, log logger.Logger,
WrapErrorFunc: libkb.WrapError,
TagsFunc: libkb.LogTagsFromContext,
ReconnectBackoff: func() backoff.BackOff { return constBackoff },
DialerTimeout: dialerTimeout,
InitialReconnectBackoffWindow: bserverReconnectBackoffWindow,
}
b.initNewConnection()
Expand Down
4 changes: 4 additions & 0 deletions libkbfs/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ const bserverReconnectBackoffWindow = time.Hour
// registerForUpdatesFireNowThreshold is the maximum length of time that
// KBFS can be idle for, in order to trigger FireNow from RegisterForUpdate.
const registerForUpdatesFireNowThreshold = 10 * time.Minute

// dialerTimeout is the TCP dial timeout used by mdserver and bserver RPC
// connections.
const dialerTimeout = 16 * time.Second
11 changes: 4 additions & 7 deletions libkbfs/mdserver_remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ var _ kbfscrypto.AuthTokenRefreshHandler = (*MDServerRemote)(nil)
// Test that MDServerRemote fully implements the ConnectionHandler interface.
var _ rpc.ConnectionHandler = (*MDServerRemote)(nil)

const dialerTimeout = 16 * time.Second

// NewMDServerRemote returns a new instance of MDServerRemote.
func NewMDServerRemote(config Config, srvRemote rpc.Remote,
rpcLogFactory rpc.LogFactory) *MDServerRemote {
Expand Down Expand Up @@ -111,11 +109,10 @@ func NewMDServerRemote(config Config, srvRemote rpc.Remote,
"libkbfs_mdserver_remote", VersionString(), mdServer)
constBackoff := backoff.NewConstantBackOff(RPCReconnectInterval)
mdServer.connOpts = rpc.ConnectionOpts{
WrapErrorFunc: libkb.WrapError,
TagsFunc: libkb.LogTagsFromContext,
ReconnectBackoff: func() backoff.BackOff { return constBackoff },
DialerTimeout: dialerTimeout,

WrapErrorFunc: libkb.WrapError,
TagsFunc: libkb.LogTagsFromContext,
ReconnectBackoff: func() backoff.BackOff { return constBackoff },
DialerTimeout: dialerTimeout,
InitialReconnectBackoffWindow: mdserverReconnectBackoffWindow,
}
mdServer.initNewConnection()
Expand Down

0 comments on commit 16fd06f

Please sign in to comment.