From 6c049dde083564af008d0e48417239953c044410 Mon Sep 17 00:00:00 2001 From: Russ Magee Date: Thu, 30 Jan 2020 23:32:36 -0800 Subject: [PATCH] More throughput-friendly hack (just delay at very end vs. each packet) Signed-off-by: Russ Magee --- xsd/xsd.go | 7 +++++++ xsnet/net.go | 4 ---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/xsd/xsd.go b/xsd/xsd.go index e20096d..23d6f25 100755 --- a/xsd/xsd.go +++ b/xsd/xsd.go @@ -26,6 +26,7 @@ import ( "strings" "sync" "syscall" + "time" "unsafe" "blitter.com/go/goutmp" @@ -796,6 +797,8 @@ func main() { } else { logger.LogNotice(fmt.Sprintf("[Command completed for %s@%s, status %d]\n", rec.Who(), hname, cmdStatus)) // nolint: gosec,errcheck } + // TODO: Test this with huge files.. see Bug #22 - do we need to + // sync w/sender (client) that we've gotten all data? hc.SetStatus(xsnet.CSOType(cmdStatus)) // Send CSOExitStatus *before* client closes channel @@ -816,6 +819,10 @@ func main() { // Returned hopefully via an EOF or exit/logout; logger.LogNotice(fmt.Sprintf("[Command completed for %s@%s, status %d]\n", rec.Who(), hname, cmdStatus)) // nolint: gosec,errcheck } + // HACK: Bug #22: (xc) Need to wait for rcvr to get final data + // TODO: Await specific msg from client to inform they have gotten all data from the tarpipe + time.Sleep(time.Duration(900 * time.Millisecond)) // Let rcvr set this on setup? + // Clear current op so user can enter next, or EOF rec.SetOp([]byte{0}) hc.SetStatus(xsnet.CSOType(cmdStatus)) diff --git a/xsnet/net.go b/xsnet/net.go index 23a2c91..421b552 100644 --- a/xsnet/net.go +++ b/xsnet/net.go @@ -1320,10 +1320,6 @@ func (hc *Conn) WritePacket(b []byte, ctrlStatOp byte) (n int, err error) { hmacOut = hc.wm.Sum(nil)[0:HMAC_CHK_SZ] //log.Printf(" (%08x> HMAC(o):%s\r\n", payloadLen, hex.EncodeToString(hmacOut)) - // HACK: Bug #22: (xc) Need flow control so sender can't overwhelm rcvr with data. - if payloadLen > 8192 { - time.Sleep(time.Duration(10 * time.Millisecond)) // Let rcvr set this on setup? - } var wb bytes.Buffer // The StreamWriter acts like a pipe, forwarding whatever is