mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-29 14:45:07 +03:00
Link state tracking tweaks and improved shutdown
This commit is contained in:
parent
ef989bef63
commit
b1283e15f6
5 changed files with 40 additions and 50 deletions
|
@ -14,6 +14,7 @@ import (
|
|||
type linkWS struct {
|
||||
phony.Inbox
|
||||
*links
|
||||
listenconfig *net.ListenConfig
|
||||
}
|
||||
|
||||
type linkWSConn struct {
|
||||
|
@ -78,6 +79,9 @@ func (s *wsServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
func (l *links) newLinkWS() *linkWS {
|
||||
lt := &linkWS{
|
||||
links: l,
|
||||
listenconfig: &net.ListenConfig{
|
||||
KeepAlive: -1,
|
||||
},
|
||||
}
|
||||
return lt
|
||||
}
|
||||
|
@ -95,7 +99,7 @@ func (l *linkWS) dial(ctx context.Context, url *url.URL, info linkInfo, options
|
|||
}
|
||||
|
||||
func (l *linkWS) listen(ctx context.Context, url *url.URL, _ string) (net.Listener, error) {
|
||||
nl, err := net.Listen("tcp", url.Host)
|
||||
nl, err := l.listenconfig.Listen(ctx, "tcp", url.Host)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue