Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various cleanups tracking issue #21

Open
0xB10C opened this issue Jun 19, 2024 · 5 comments
Open

Various cleanups tracking issue #21

0xB10C opened this issue Jun 19, 2024 · 5 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@0xB10C
Copy link
Owner

0xB10C commented Jun 19, 2024

Posting potential cleanups and small refactors that should be made at some point here:

@0xB10C 0xB10C added help wanted Extra attention is needed good first issue Good for newcomers labels Jun 19, 2024
@0xB10C
Copy link
Owner Author

0xB10C commented Jun 19, 2024

Addressing these TODOs would be good

// TODO: comment
pub fn peer_addr(&self) -> String {
String::from_utf8_lossy(&self.peer_addr.split(|c| *c == 0x00u8).next().unwrap())
.into_owned()
}
// TODO: comment
pub fn peer_conn_type(&self) -> String {
String::from_utf8_lossy(&self.peer_conn_type.split(|c| *c == 0x00u8).next().unwrap())
.into_owned()
}
// TODO: comment
pub fn msg_type(&self) -> String {
String::from_utf8_lossy(&self.msg_type.split(|c| *c == 0x00u8).next().unwrap()).into_owned()
}
pub fn from_bytes(x: &[u8]) -> Self {
unsafe { ptr::read_unaligned(x.as_ptr() as *const Self) }
}

@0xB10C
Copy link
Owner Author

0xB10C commented Jun 19, 2024

MAX_SMALL_MSG_LENGTH in this comment is incorrect. It should be N. Also, there's a typo in acccctual

// The msg.payload is MAX_SMALL_MSG_LENGTH bytes long, however the acctual

fixed with #22

@0xB10C
Copy link
Owner Author

0xB10C commented Jun 19, 2024

More todos that can be addressed

// TODO: comment
pub fn addr(&self) -> String {
String::from_utf8_lossy(&self.addr.split(|c| *c == 0x00u8).next().unwrap()).into_owned()
}
// TODO: comment

@0xB10C
Copy link
Owner Author

0xB10C commented Jun 19, 2024

// TODO: comment
pub fn addr(&self) -> String {
String::from_utf8_lossy(&self.addr.split(|c| *c == 0x00u8).next().unwrap()).into_owned()
}
// TODO: comment
pub fn source(&self) -> String {

@0xB10C
Copy link
Owner Author

0xB10C commented Jun 19, 2024

typo:

// The acctual message ends after the "92e4200d3021c21b" payload. It's a few bytes larger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant