diff options
| author | Xe Iaso <me@xeiaso.net> | 2023-08-16 08:49:13 -0400 |
|---|---|---|
| committer | Xe Iaso <me@xeiaso.net> | 2023-08-16 08:49:13 -0400 |
| commit | 8c556added2b3cb2517526930d49be167402e339 (patch) | |
| tree | 9cca747bb02a7b258250d249dc6f4afb91c1f228 /cmd | |
| parent | fbd73f85e01eb0895e07c91210c903577fa30e10 (diff) | |
| download | x-8c556added2b3cb2517526930d49be167402e339.tar.xz x-8c556added2b3cb2517526930d49be167402e339.zip | |
cmd/sanguisuga: move things, go mod tidy
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/sanguisuga/dcc.go | 2 | ||||
| -rw-r--r-- | cmd/sanguisuga/internal/dcc/dcc.go (renamed from cmd/sanguisuga/dcc/dcc.go) | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/cmd/sanguisuga/dcc.go b/cmd/sanguisuga/dcc.go index ca232a8..fc44798 100644 --- a/cmd/sanguisuga/dcc.go +++ b/cmd/sanguisuga/dcc.go @@ -22,7 +22,7 @@ import ( irc "github.com/thoj/go-ircevent" "golang.org/x/exp/slog" "tailscale.com/metrics" - "within.website/x/cmd/sanguisuga/dcc" + "within.website/x/cmd/sanguisuga/internal/dcc" ) var ( diff --git a/cmd/sanguisuga/dcc/dcc.go b/cmd/sanguisuga/internal/dcc/dcc.go index c26b141..ff35941 100644 --- a/cmd/sanguisuga/dcc/dcc.go +++ b/cmd/sanguisuga/internal/dcc/dcc.go @@ -2,6 +2,7 @@ package dcc import ( "context" + "encoding/binary" "io" "net" "time" @@ -108,6 +109,18 @@ D: return // terminated.. case <-ticker.C: d.progress(float64(written), &speed) + // notify the other side about the state of the connection + writtenNetworkOrder := uint32(written) + if err := binary.Write(d.conn, binary.BigEndian, writtenNetworkOrder); err != nil { + if err == io.EOF { + err = nil + } + + d.progress(float64(written), &speed) + d.done <- err + + return + } default: n, err := reader.Read(buf) |
