Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit03a7d2f

Browse files
authored
1 parent2d2bea7 commit03a7d2f

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

‎coderd/tailnet.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,10 @@ func (s *ServerTailnet) watchAgentUpdates() {
229229

230230
err:=s.conn.UpdateNodes(nodes,false)
231231
iferr!=nil {
232+
ifxerrors.Is(err,tailnet.ErrConnClosed) {
233+
s.logger.Warn(context.Background(),"tailnet conn closed, exiting watchAgentUpdates",slog.Error(err))
234+
return
235+
}
232236
s.logger.Error(context.Background(),"update node in server tailnet",slog.Error(err))
233237
return
234238
}

‎tailnet/conn.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ import (
4747
"github.com/coder/coder/v2/cryptorand"
4848
)
4949

50+
varErrConnClosed=xerrors.New("connection closed")
51+
5052
const (
5153
WorkspaceAgentSSHPort=1
5254
WorkspaceAgentReconnectingPTYPort=2
@@ -496,7 +498,7 @@ func (c *Conn) UpdateNodes(nodes []*Node, replacePeers bool) error {
496498
deferc.mutex.Unlock()
497499

498500
ifc.isClosed() {
499-
returnxerrors.New("connection closed")
501+
returnErrConnClosed
500502
}
501503

502504
status:=c.Status()
@@ -590,7 +592,7 @@ func (c *Conn) RemovePeer(selector PeerSelector) (deleted bool, err error) {
590592
deferc.mutex.Unlock()
591593

592594
ifc.isClosed() {
593-
returnfalse,xerrors.New("connection closed")
595+
returnfalse,ErrConnClosed
594596
}
595597

596598
deleted=false
@@ -919,7 +921,7 @@ func (c *Conn) Listen(network, addr string) (net.Listener, error) {
919921
c.mutex.Lock()
920922
ifc.isClosed() {
921923
c.mutex.Unlock()
922-
returnnil,xerrors.New("closed")
924+
returnnil,ErrConnClosed
923925
}
924926
ifc.listeners==nil {
925927
c.listeners=map[listenKey]*listener{}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp