From 862c0c3d7f5a6630f3f6ed1609c43c7048650b49 Mon Sep 17 00:00:00 2001 From: Russ Magee Date: Thu, 30 Jan 2020 21:14:35 -0800 Subject: [PATCH] Hack to throttle data overrun (sender->rcvr) during large xc operations Signed-off-by: Russ Magee --- xsnet/net.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xsnet/net.go b/xsnet/net.go index 60ab5db..23a2c91 100644 --- a/xsnet/net.go +++ b/xsnet/net.go @@ -1319,7 +1319,11 @@ func (hc *Conn) WritePacket(b []byte, ctrlStatOp byte) (n int, err error) { hc.wm.Write(b[0:payloadLen]) hmacOut = hc.wm.Sum(nil)[0:HMAC_CHK_SZ] - log.Printf(" (%04x> HMAC(o):%s\r\n", payloadLen, hex.EncodeToString(hmacOut)) + //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