Skip to content

Commit 825ee4f

Browse files
committed
fix: byte consumption logic in connection inbox
1 parent eb4154b commit 825ee4f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

stackslib/src/net/connection.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,12 @@ impl<P: ProtocolFamily> ConnectionInbox<P> {
937937
);
938938
self.inbox.push_back(message);
939939
consumed_message = true;
940-
};
940+
} else {
941+
if bytes_consumed == 0 {
942+
warn!("0 bytes consumed, but no message parsed");
943+
return Err(net_error::ConnectionBroken);
944+
}
945+
}
941946

942947
bytes_consumed
943948
} else {

0 commit comments

Comments
 (0)