mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-15 10:40:41 -07:00
Use default port for leafnode remote if not specified
Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
@@ -143,6 +143,9 @@ const (
|
||||
// DEFAULT_LEAFNODE_INFO_WAIT Route dial timeout.
|
||||
DEFAULT_LEAFNODE_INFO_WAIT = 1 * time.Second
|
||||
|
||||
// DEFAULT_LEAFNODE_PORT is the default port for remote leafnode connections.
|
||||
DEFAULT_LEAFNODE_PORT = 7422
|
||||
|
||||
// DEFAULT_CONNECT_ERROR_REPORTS is the number of attempts at which a
|
||||
// repeated failed route, gateway or leaf node connection is reported.
|
||||
// This is used for initial connection, that is, when the server has
|
||||
|
||||
@@ -2432,10 +2432,18 @@ func setBaselineOptions(opts *Options) {
|
||||
opts.LeafNode.AuthTimeout = float64(AUTH_TIMEOUT) / float64(time.Second)
|
||||
}
|
||||
}
|
||||
// Set baseline connect port for remotes.
|
||||
for _, r := range opts.LeafNode.Remotes {
|
||||
if r != nil && r.URL.Port() == "" {
|
||||
r.URL.Host = fmt.Sprintf("%s:%d", r.URL.Host, DEFAULT_LEAFNODE_PORT)
|
||||
}
|
||||
}
|
||||
|
||||
// Set this regardless of opts.LeafNode.Port
|
||||
if opts.LeafNode.ReconnectInterval == 0 {
|
||||
opts.LeafNode.ReconnectInterval = DEFAULT_LEAF_NODE_RECONNECT
|
||||
}
|
||||
|
||||
if opts.MaxControlLine == 0 {
|
||||
opts.MaxControlLine = MAX_CONTROL_LINE_SIZE
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user