fix(lib): route on the full four-byte message code
Dispatch read one byte of the code, so a code with a non-zero high byte was handled as its low byte. Message::get_message_code now reads the whole little-endian uint32 and handlers register by u32. PeerInit and PierceFirewall, the only frames with a one-byte code, get their own accessor for the listener's first frame.
This commit is contained in:
@@ -481,7 +481,7 @@ impl SeederState {
|
||||
let Ok(init) = read_framed(&mut p) else {
|
||||
return;
|
||||
};
|
||||
if init.get_message_code() != 1 {
|
||||
if init.get_init_code() != 1 {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -735,7 +735,7 @@ fn accept_file_connection(
|
||||
let Ok(mut init) = read_framed(&mut stream) else {
|
||||
continue;
|
||||
};
|
||||
if init.get_message_code() != 1 {
|
||||
if init.get_init_code() != 1 {
|
||||
continue;
|
||||
}
|
||||
init.set_pointer(5);
|
||||
|
||||
Reference in New Issue
Block a user