mirror of https://gogs.blitter.com/RLabs/xs
				
				
				
			-Removed WriteDeadline in hkexnet.Close()
-hkexsh: fixed (non-)error handling for file copies Signed-off-by: Russ Magee <rmagee@gmail.com>
This commit is contained in:
		
							parent
							
								
									6ac866fdbf
								
							
						
					
					
						commit
						5fb227b9f8
					
				| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue