go.crypto/ssh: add a error return to decode(), and avoid casting decode() output.
R=dave, kardianos, agl CC=gobot, golang-dev https://golang.org/cl/9738053
This commit is contained in:
committed by
Adam Langley
parent
e8889f5e72
commit
36bf31eb71
+9
-2
@@ -249,8 +249,15 @@ func (c *ClientConn) mainLoop() {
|
||||
ch.stderr.write(packet)
|
||||
}
|
||||
default:
|
||||
msg := decode(packet)
|
||||
switch msg := msg.(type) {
|
||||
decoded, err := decode(packet)
|
||||
if err != nil {
|
||||
if _, ok := err.(UnexpectedMessageError); ok {
|
||||
fmt.Printf("mainLoop: unexpected message: %v\n", err)
|
||||
continue
|
||||
}
|
||||
return
|
||||
}
|
||||
switch msg := decoded.(type) {
|
||||
case *channelOpenMsg:
|
||||
c.handleChanOpen(msg)
|
||||
case *channelOpenConfirmMsg:
|
||||
|
||||
Reference in New Issue
Block a user