architecting peer

This commit is contained in:
Jae Kwon
2014-06-24 17:28:40 -07:00
parent 12c12b1a72
commit 002cfc8f75
14 changed files with 986 additions and 1043 deletions

View File

@ -48,6 +48,13 @@ func ReadByte(r io.Reader) Byte {
return Byte(buf[0])
}
func ReadByteSafe(r io.Reader) (Byte, error) {
buf := [1]byte{0}
_, err := io.ReadFull(r, buf[:])
if err != nil { return Byte(0), err }
return Byte(buf[0]), nil
}
// Int8