brontide: add additional detail to handshake version error message

This commit adds some additional detail to the error message
encountered when the first byte of an act is an invalid handshake
version byte. This commit is meant to aide in tracking down a
re-occurring bug that has been encountered by early testers of the
software.
This commit is contained in:
Olaoluwa Osuntokun 2017-07-29 11:56:38 -07:00
parent 5ad6c23848
commit e87cc29b36
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -427,8 +427,9 @@ func (b *Machine) RecvActOne(actOne [ActOneSize]byte) error {
// If the handshake version is unknown, then the handshake fails
// immediately.
if actOne[0] != HandshakeVersion {
return fmt.Errorf("Invalid handshake version: %v, only %v is "+
"valid", actOne[0], HandshakeVersion)
return fmt.Errorf("Act One: invalid handshake version: %v, "+
"only %v is valid, msg=%x", actOne[0], HandshakeVersion,
actOne[:])
}
copy(e[:], actOne[1:34])
@ -498,8 +499,9 @@ func (b *Machine) RecvActTwo(actTwo [ActTwoSize]byte) error {
// If the handshake version is unknown, then the handshake fails
// immediately.
if actTwo[0] != HandshakeVersion {
return fmt.Errorf("Invalid handshake version: %v, only %v is "+
"valid", actTwo[0], HandshakeVersion)
return fmt.Errorf("Act Two: invalid handshake version: %v, "+
"only %v is valid, msg=%x", actTwo[0], HandshakeVersion,
actTwo[:])
}
copy(e[:], actTwo[1:34])
@ -563,8 +565,9 @@ func (b *Machine) RecvActThree(actThree [ActThreeSize]byte) error {
// If the handshake version is unknown, then the handshake fails
// immediately.
if actThree[0] != HandshakeVersion {
return fmt.Errorf("Invalid handshake version: %v, only %v is "+
"valid", actThree[0], HandshakeVersion)
return fmt.Errorf("Act Three: invalid handshake version: %v, "+
"only %v is valid, msg=%x", actThree[0], HandshakeVersion,
actThree[:])
}
// TODO(roasbeef): print out entire version each time, also print out