so, that was a B7, not an 87. hours of my life gone, because of two pixels
This commit is contained in:
parent
d942d615d5
commit
c388eb1fc5
|
@ -13,7 +13,7 @@ impl std::fmt::Display for InvalidHeartbeatResponse {
|
|||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"Invalid heartbeat response: expected 0x87, got 0x{}",
|
||||
"Invalid heartbeat response: expected 0xB7, got 0x{}",
|
||||
self.0
|
||||
)
|
||||
}
|
||||
|
@ -31,9 +31,10 @@ impl Aws {
|
|||
svm_family: SocketFamily::Vsock as u16,
|
||||
svm_port: 9000,
|
||||
svm_cid: 3,
|
||||
..(unsafe { std::mem::zeroed() })
|
||||
svm_reserved1: 0,
|
||||
svm_zero: [0; 4],
|
||||
};
|
||||
let mut buf = [0x87];
|
||||
let mut buf = [0xB7];
|
||||
|
||||
let fd = socket(SocketFamily::Vsock, SocketType::Stream)?;
|
||||
unsafe {
|
||||
|
@ -43,11 +44,12 @@ impl Aws {
|
|||
std::mem::size_of_val(&sockaddr),
|
||||
)?;
|
||||
};
|
||||
dbg!(write(fd, &buf));
|
||||
dbg!(read(fd, &mut buf));
|
||||
dbg!(close(fd));
|
||||
|
||||
if buf[0] != 0x87 {
|
||||
write(fd, &buf)?;
|
||||
read(fd, &mut buf)?;
|
||||
close(fd)?;
|
||||
|
||||
if buf[0] != 0xB7 {
|
||||
return Err(InvalidHeartbeatResponse(buf[0]))
|
||||
.context(format_args!("Bad value from heartbeat"));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue