mirror of https://gogs.blitter.com/RLabs/xs
				
				
				
			More throughput-friendly hack (just delay at very end vs. each packet)
Signed-off-by: Russ Magee <rmagee@gmail.com>
This commit is contained in:
		
							parent
							
								
									862c0c3d7f
								
							
						
					
					
						commit
						6c049dde08
					
				| 
						 | 
				
			
			@ -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))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue