mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-11-23 18:15:24 +00:00
Don't spawn goroutines for addPeerLoop, TCP connect timeout of 5 seconds for now
This commit is contained in:
parent
64570a8d3e
commit
909e4e29a8
@ -91,21 +91,17 @@ func (c *Core) _addPeerLoop() {
|
|||||||
|
|
||||||
// Add peers from the Peers section
|
// Add peers from the Peers section
|
||||||
for _, peer := range current.Peers {
|
for _, peer := range current.Peers {
|
||||||
go func() {
|
|
||||||
if err := c.AddPeer(peer, ""); err != nil {
|
if err := c.AddPeer(peer, ""); err != nil {
|
||||||
c.log.Errorln("Failed to add peer:", err)
|
c.log.Errorln("Failed to add peer:", err)
|
||||||
}
|
}
|
||||||
}() // TODO: this should be acted and not in a goroutine?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add peers from the InterfacePeers section
|
// Add peers from the InterfacePeers section
|
||||||
for intf, intfpeers := range current.InterfacePeers {
|
for intf, intfpeers := range current.InterfacePeers {
|
||||||
for _, peer := range intfpeers {
|
for _, peer := range intfpeers {
|
||||||
go func() {
|
|
||||||
if err := c.AddPeer(peer, intf); err != nil {
|
if err := c.AddPeer(peer, intf); err != nil {
|
||||||
c.log.Errorln("Failed to add peer:", err)
|
c.log.Errorln("Failed to add peer:", err)
|
||||||
}
|
}
|
||||||
}() // TODO: this should be acted and not in a goroutine?
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ func (l *link) reconfigure() {
|
|||||||
func (l *link) call(uri string, sintf string) error {
|
func (l *link) call(uri string, sintf string) error {
|
||||||
u, err := url.Parse(uri)
|
u, err := url.Parse(uri)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("peer %s is not correctly formatted (%s)", uri, err)
|
return fmt.Errorf("peer %s is not correctly formatted", uri)
|
||||||
}
|
}
|
||||||
pathtokens := strings.Split(strings.Trim(u.Path, "/"), "/")
|
pathtokens := strings.Split(strings.Trim(u.Path, "/"), "/")
|
||||||
switch u.Scheme {
|
switch u.Scheme {
|
||||||
|
@ -266,6 +266,7 @@ func (t *tcp) call(saddr string, options interface{}, sintf string) {
|
|||||||
}
|
}
|
||||||
dialer := net.Dialer{
|
dialer := net.Dialer{
|
||||||
Control: t.tcpContext,
|
Control: t.tcpContext,
|
||||||
|
Timeout: time.Second * 5,
|
||||||
}
|
}
|
||||||
if sintf != "" {
|
if sintf != "" {
|
||||||
ief, err := net.InterfaceByName(sintf)
|
ief, err := net.InterfaceByName(sintf)
|
||||||
|
Loading…
Reference in New Issue
Block a user