Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
-
skipped 7 lines 8 8 "net" 9 9 "os" 10 10 "os/user" 11 + "strconv" 11 12 "strings" 12 13 "time" 13 14 skipped 140 lines 154 155 continue 155 156 } 156 157 157 - sshConn, chans, reqs, err := ssh.NewClientConn(conn, addr, config) 158 + realConn := &internal.TimeoutConn{conn, 4 * time.Minute} 159 + 160 + sshConn, chans, reqs, err := ssh.NewClientConn(realConn, addr, config) 158 161 if err != nil { 159 - conn.Close() 162 + realConn.Close() 160 163 161 164 log.Printf("Unable to start a new client connection: %s\n", err) 162 165 <-time.After(10 * time.Second) skipped 10 lines 173 176 case "kill": 174 177 log.Println("Got kill command, goodbye") 175 178 os.Exit(0) 179 + 180 + case "[email protected]": 181 + req.Reply(false, nil) 182 + timeout, err := strconv.Atoi(string(req.Payload)) 183 + if err != nil { 184 + continue 185 + } 186 + 187 + realConn.Timeout = time.Duration(timeout*2) * time.Second 176 188 177 189 default: 178 190 if req.WantReply { skipped 29 lines -
skipped 289 lines 290 290 291 291 go func() { 292 292 for { 293 - _, _, err = sshConn.SendRequest("[email protected]", true, nil) 293 + _, _, err = sshConn.SendRequest("keepalive-rssh@golang.org", true, []byte(fmt.Sprintf("%d", timeout))) 294 294 if err != nil { 295 295 clientLog.Info("Failed to send keepalive, assuming client has disconnected") 296 296 sshConn.Close() skipped 78 lines