Make `is_compressed` immutable

pull/235/head
kazk 4 years ago
parent 147593f27f
commit fdb82ed428
  1. 9
      src/protocol/mod.rs

@ -505,17 +505,14 @@ impl WebSocketContext {
// the negotiated extensions defines the meaning of such a nonzero // the negotiated extensions defines the meaning of such a nonzero
// value, the receiving endpoint MUST _Fail the WebSocket // value, the receiving endpoint MUST _Fail the WebSocket
// Connection_. // Connection_.
let mut is_compressed = false; let is_compressed = {
{
let hdr = frame.header(); let hdr = frame.header();
if (hdr.rsv1 && self.pmce.is_none()) || hdr.rsv2 || hdr.rsv3 { if (hdr.rsv1 && self.pmce.is_none()) || hdr.rsv2 || hdr.rsv3 {
return Err(Error::Protocol(ProtocolError::NonZeroReservedBits)); return Err(Error::Protocol(ProtocolError::NonZeroReservedBits));
} }
if hdr.rsv1 && self.pmce.is_some() { hdr.rsv1
is_compressed = true; };
}
}
match self.role { match self.role {
Role::Server => { Role::Server => {

Loading…
Cancel
Save