x/crypto/ssh: interpret disconnect message as error in the transport layer.
This ensures that higher level parts (e.g. the client authentication loop) never have to deal with disconnect messages. Fixes https://github.com/coreos/fleet/issues/565. Change-Id: Ie164b6c4b0982c7ed9af6d3bf91697a78a911a20 Reviewed-on: https://go-review.googlesource.com/20801 Reviewed-by: Anton Khramov <anton@endocode.com> Reviewed-by: Adam Langley <agl@golang.org>
This commit is contained in:
committed by
Adam Langley
parent
c7e3b0ebdd
commit
9e7f5dc375
@@ -331,7 +331,6 @@ func TestMuxGlobalRequest(t *testing.T) {
|
||||
ok, data, err)
|
||||
}
|
||||
|
||||
clientMux.Disconnect(0, "")
|
||||
if !seen {
|
||||
t.Errorf("never saw 'peek' request")
|
||||
}
|
||||
@@ -378,28 +377,6 @@ func TestMuxChannelRequestUnblock(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMuxDisconnect(t *testing.T) {
|
||||
a, b := muxPair()
|
||||
defer a.Close()
|
||||
defer b.Close()
|
||||
|
||||
go func() {
|
||||
for r := range b.incomingRequests {
|
||||
r.Reply(true, nil)
|
||||
}
|
||||
}()
|
||||
|
||||
a.Disconnect(42, "whatever")
|
||||
ok, _, err := a.SendRequest("hello", true, nil)
|
||||
if ok || err == nil {
|
||||
t.Errorf("got reply after disconnecting")
|
||||
}
|
||||
err = b.Wait()
|
||||
if d, ok := err.(*disconnectMsg); !ok || d.Reason != 42 {
|
||||
t.Errorf("got %#v, want disconnectMsg{Reason:42}", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMuxCloseChannel(t *testing.T) {
|
||||
r, w, mux := channelPair(t)
|
||||
defer mux.Close()
|
||||
|
||||
Reference in New Issue
Block a user