Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Add retries to coder agent start cmd #316

Merged
merged 2 commits into from
Apr 16, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add more error logs
  • Loading branch information
f0ssel committed Apr 15, 2021
commit 6580c8042690ecf58a0ca67752c2baa3aa877ddd
20 changes: 17 additions & 3 deletions agent/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,16 @@ func (s *stream) processDataChannel(channel *webrtc.DataChannel) {
return
}
d := make([]byte, 64)
_, _ = rw.Read(d)
_, _ = rw.Write(d)
_, err = rw.Read(d)
if err != nil {
s.logger.Error(context.Background(), "read ping", slog.Error(err))
return
}
_, err = rw.Write(d)
if err != nil {
s.logger.Error(context.Background(), "write ping", slog.Error(err))
return
}
})
return
}
Expand Down Expand Up @@ -162,10 +170,16 @@ func (s *stream) processDataChannel(channel *webrtc.DataChannel) {
return
}
go func() {
_, _ = io.Copy(rw, conn)
_, err = io.Copy(rw, conn)
if err != nil {
s.logger.Error(context.Background(), "copy to conn", slog.Error(err))
}
}()
go func() {
_, _ = io.Copy(conn, rw)
if err != nil {
s.logger.Error(context.Background(), "copy from conn", slog.Error(err))
}
}()
})
}