diff --git a/hkexnet/hkexnet.go b/hkexnet/hkexnet.go index 50dd870..21e6fda 100644 --- a/hkexnet/hkexnet.go +++ b/hkexnet/hkexnet.go @@ -537,7 +537,7 @@ func (hc *Conn) Close() (err error) { s := make([]byte, 4) binary.BigEndian.PutUint32(s, uint32(*hc.closeStat)) log.Printf("** Writing closeStat %d at Close()\n", *hc.closeStat) - (*hc.c).SetWriteDeadline(time.Now().Add(500 * time.Millisecond)) + //(*hc.c).SetWriteDeadline(time.Now().Add(500 * time.Millisecond)) hc.WritePacket(s, CSOExitStatus) // This avoids a bug where server side may not get its last packet of // data through to a client for non-interactive commands which exit diff --git a/hkexsh/hkexsh.go b/hkexsh/hkexsh.go index 0ee7c9d..312f8f6 100755 --- a/hkexsh/hkexsh.go +++ b/hkexsh/hkexsh.go @@ -148,8 +148,12 @@ func doCopyMode(conn *hkexnet.Conn, remoteDest bool, files string, rec *hkexsh.S // Do a final read for remote's exit status s := make([]byte, 4) _, remErr := conn.Read(s) - if remErr != io.EOF && !strings.Contains(remErr.Error(), "use of closed network") { + if remErr != io.EOF && + !strings.Contains(remErr.Error(), "use of closed network") && + !strings.Contains(remErr.Error(), "connection reset by peer") { fmt.Printf("*** remote status Read() failed: %v\n", remErr) + } else { + conn.SetStatus(0) // cp finished OK } // If local side status was OK, use remote side's status @@ -206,7 +210,7 @@ func doCopyMode(conn *hkexnet.Conn, remoteDest bool, files string, rec *hkexsh.S if exitStatus == 0 { exitStatus = uint32(conn.GetStatus()) } - fmt.Printf("*** server->client cp finished, status %d ***\n", conn.GetStatus()) + log.Printf("*** server->client cp finished, status %d ***\n", conn.GetStatus()) } } return