mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-22 17:40:26 +00:00
Be more verbose when a peer or listener is badly formatted
This commit is contained in:
parent
a62e029e21
commit
846df4789a
@ -91,15 +91,21 @@ func (c *Core) _addPeerLoop() {
|
||||
|
||||
// Add peers from the Peers section
|
||||
for _, peer := range current.Peers {
|
||||
go c.AddPeer(peer, "") // TODO: this should be acted and not in a goroutine?
|
||||
time.Sleep(time.Second)
|
||||
go func() {
|
||||
if err := c.AddPeer(peer, ""); err != nil {
|
||||
c.log.Errorln("Failed to add peer:", err)
|
||||
}
|
||||
}() // TODO: this should be acted and not in a goroutine?
|
||||
}
|
||||
|
||||
// Add peers from the InterfacePeers section
|
||||
for intf, intfpeers := range current.InterfacePeers {
|
||||
for _, peer := range intfpeers {
|
||||
go c.AddPeer(peer, intf) // TODO: this should be acted and not in a goroutine?
|
||||
time.Sleep(time.Second)
|
||||
go func() {
|
||||
if err := c.AddPeer(peer, intf); err != nil {
|
||||
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 {
|
||||
u, err := url.Parse(uri)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("peer %s is not correctly formatted (%s)", uri, err)
|
||||
}
|
||||
pathtokens := strings.Split(strings.Trim(u.Path, "/"), "/")
|
||||
switch u.Scheme {
|
||||
@ -103,7 +103,7 @@ func (l *link) call(uri string, sintf string) error {
|
||||
func (l *link) listen(uri string) error {
|
||||
u, err := url.Parse(uri)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("listener %s is not correctly formatted (%s)", uri, err)
|
||||
}
|
||||
switch u.Scheme {
|
||||
case "tcp":
|
||||
|
@ -85,6 +85,7 @@ func (t *tcp) init(l *link) error {
|
||||
defer t.link.core.config.Mutex.RUnlock()
|
||||
for _, listenaddr := range t.link.core.config.Current.Listen {
|
||||
if listenaddr[:6] != "tcp://" {
|
||||
t.link.core.log.Errorln("Failed to add listener: listener", listenaddr, "is not correctly formatted, ignoring")
|
||||
continue
|
||||
}
|
||||
if _, err := t.listen(listenaddr[6:]); err != nil {
|
||||
@ -103,6 +104,7 @@ func (t *tcp) reconfigure() {
|
||||
if len(added) > 0 || len(deleted) > 0 {
|
||||
for _, a := range added {
|
||||
if a[:6] != "tcp://" {
|
||||
t.link.core.log.Errorln("Failed to add listener: listener", a, "is not correctly formatted, ignoring")
|
||||
continue
|
||||
}
|
||||
if _, err := t.listen(a[6:]); err != nil {
|
||||
@ -113,6 +115,7 @@ func (t *tcp) reconfigure() {
|
||||
}
|
||||
for _, d := range deleted {
|
||||
if d[:6] != "tcp://" {
|
||||
t.link.core.log.Errorln("Failed to delete listener: listener", d, "is not correctly formatted, ignoring")
|
||||
continue
|
||||
}
|
||||
t.mutex.Lock()
|
||||
|
Loading…
Reference in New Issue
Block a user