mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	Silence error when reconnecting to already connected peer
This commit is contained in:
		
							parent
							
								
									5ad8c33d26
								
							
						
					
					
						commit
						0abfe78858
					
				
					 1 changed files with 7 additions and 5 deletions
				
			
		| 
						 | 
					@ -113,18 +113,20 @@ func (l *links) isConnectedTo(info linkInfo) bool {
 | 
				
			||||||
func (l *links) call(u *url.URL, sintf string) error {
 | 
					func (l *links) call(u *url.URL, sintf string) error {
 | 
				
			||||||
	info := linkInfoFor(u.Scheme, sintf, u.Host)
 | 
						info := linkInfoFor(u.Scheme, sintf, u.Host)
 | 
				
			||||||
	if l.isConnectedTo(info) {
 | 
						if l.isConnectedTo(info) {
 | 
				
			||||||
		return fmt.Errorf("already connected to this node")
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	options := linkOptions{
 | 
						options := linkOptions{
 | 
				
			||||||
		pinnedEd25519Keys: map[keyArray]struct{}{},
 | 
							pinnedEd25519Keys: map[keyArray]struct{}{},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for _, pubkey := range u.Query()["key"] {
 | 
						for _, pubkey := range u.Query()["key"] {
 | 
				
			||||||
		if sigPub, err := hex.DecodeString(pubkey); err == nil {
 | 
							sigPub, err := hex.DecodeString(pubkey)
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return fmt.Errorf("pinned key contains invalid hex characters")
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		var sigPubKey keyArray
 | 
							var sigPubKey keyArray
 | 
				
			||||||
		copy(sigPubKey[:], sigPub)
 | 
							copy(sigPubKey[:], sigPub)
 | 
				
			||||||
		options.pinnedEd25519Keys[sigPubKey] = struct{}{}
 | 
							options.pinnedEd25519Keys[sigPubKey] = struct{}{}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	switch info.linkType {
 | 
						switch info.linkType {
 | 
				
			||||||
	case "tcp":
 | 
						case "tcp":
 | 
				
			||||||
		go func() {
 | 
							go func() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue