diff --git a/src/platform/aws.rs b/src/platform/aws.rs index c2f6b66..5a24dc8 100644 --- a/src/platform/aws.rs +++ b/src/platform/aws.rs @@ -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")); }