-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
change gossip dns conn limit by ENV #5077
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ package mesh | |
import ( | ||
"fmt" | ||
"net" | ||
"os" | ||
"strconv" | ||
"time" | ||
|
||
|
@@ -39,10 +40,23 @@ type MeshGossiper struct { | |
} | ||
|
||
func NewMeshGossiper(listen string, channelName string, nodeName string, password []byte, seeds gossip.SeedProvider) (*MeshGossiper, error) { | ||
|
||
connLimit := 64 | ||
gossipDnsConnLimit := os.Getenv("GOSSIP_DNS_CONN_LIMIT") | ||
if gossipDnsConnLimit != "" { | ||
limit, err := strconv.Atoi(gossipDnsConnLimit) | ||
if err != nil { | ||
return nil, fmt.Errorf("cannot parse env GOSSIP_DNS_CONN_LIMIT value: %v", gossipDnsConnLimit) | ||
} | ||
connLimit = limit | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line can just be above,
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we put all in one statement, it will output the following error(create a new inner scope var):
so i split it :) |
||
} | ||
|
||
glog.Infof("gossip dns connection limit is:%d", connLimit) | ||
|
||
meshConfig := mesh.Config{ | ||
ProtocolMinVersion: mesh.ProtocolMinVersion, | ||
Password: password, | ||
ConnLimit: 64, | ||
ConnLimit: connLimit, | ||
PeerDiscovery: true, | ||
//TrustedSubnets: []*net.IPNet{}, | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also add
err
to messageThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, thanks.