Modified Fin enum values to PascalCase values
This commit is contained in:
parent
46fc6f927f
commit
4a1919e0fb
@ -4,8 +4,8 @@
|
||||
*
|
||||
* The MIT License
|
||||
*
|
||||
* Copyright (c) 2012-2013 sta.blockhead
|
||||
*
|
||||
* Copyright (c) 2012-2014 sta.blockhead
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
@ -15,7 +15,7 @@
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@ -28,11 +28,11 @@
|
||||
|
||||
using System;
|
||||
|
||||
namespace WebSocketSharp {
|
||||
|
||||
namespace WebSocketSharp
|
||||
{
|
||||
internal enum Fin : byte
|
||||
{
|
||||
MORE = 0x0,
|
||||
FINAL = 0x1
|
||||
More = 0x0,
|
||||
Final = 0x1
|
||||
}
|
||||
}
|
||||
|
@ -1079,7 +1079,7 @@ namespace WebSocketSharp
|
||||
}
|
||||
|
||||
var mask = _client ? Mask.MASK : Mask.UNMASK;
|
||||
sent = send (WsFrame.CreateFrame (Fin.FINAL, opcode, mask, data, compressed));
|
||||
sent = send (WsFrame.CreateFrame (Fin.Final, opcode, mask, data, compressed));
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.Fatal (ex.ToString ());
|
||||
@ -1173,20 +1173,20 @@ namespace WebSocketSharp
|
||||
if (quo == 0) {
|
||||
buffer = new byte [rem];
|
||||
return stream.Read (buffer, 0, rem) == rem &&
|
||||
send (WsFrame.CreateFrame (Fin.FINAL, opcode, mask, buffer, compressed));
|
||||
send (WsFrame.CreateFrame (Fin.Final, opcode, mask, buffer, compressed));
|
||||
}
|
||||
|
||||
buffer = new byte [FragmentLength];
|
||||
|
||||
// First
|
||||
if (stream.Read (buffer, 0, FragmentLength) != FragmentLength ||
|
||||
!send (WsFrame.CreateFrame (Fin.MORE, opcode, mask, buffer, compressed)))
|
||||
!send (WsFrame.CreateFrame (Fin.More, opcode, mask, buffer, compressed)))
|
||||
return false;
|
||||
|
||||
// Mid
|
||||
for (long i = 0; i < times; i++) {
|
||||
if (stream.Read (buffer, 0, FragmentLength) != FragmentLength ||
|
||||
!send (WsFrame.CreateFrame (Fin.MORE, Opcode.CONT, mask, buffer, compressed)))
|
||||
!send (WsFrame.CreateFrame (Fin.More, Opcode.CONT, mask, buffer, compressed)))
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1196,7 +1196,7 @@ namespace WebSocketSharp
|
||||
buffer = new byte [tmpLen = rem];
|
||||
|
||||
return stream.Read (buffer, 0, tmpLen) == tmpLen &&
|
||||
send (WsFrame.CreateFrame (Fin.FINAL, Opcode.CONT, mask, buffer, compressed));
|
||||
send (WsFrame.CreateFrame (Fin.Final, Opcode.CONT, mask, buffer, compressed));
|
||||
}
|
||||
|
||||
// As client
|
||||
@ -1443,7 +1443,7 @@ namespace WebSocketSharp
|
||||
byte [] cached;
|
||||
if (!cache.TryGetValue (_compression, out cached)) {
|
||||
cached = WsFrame.CreateFrame (
|
||||
Fin.FINAL,
|
||||
Fin.Final,
|
||||
opcode,
|
||||
Mask.UNMASK,
|
||||
data.Compress (_compression),
|
||||
|
@ -67,7 +67,7 @@ namespace WebSocketSharp
|
||||
}
|
||||
|
||||
public WsFrame (Opcode opcode, Mask mask, PayloadData payload)
|
||||
: this (Fin.FINAL, opcode, mask, payload)
|
||||
: this (Fin.Final, opcode, mask, payload)
|
||||
{
|
||||
}
|
||||
|
||||
@ -166,13 +166,13 @@ namespace WebSocketSharp
|
||||
|
||||
internal bool IsFinal {
|
||||
get {
|
||||
return Fin == Fin.FINAL;
|
||||
return Fin == Fin.Final;
|
||||
}
|
||||
}
|
||||
|
||||
internal bool IsFragmented {
|
||||
get {
|
||||
return Fin == Fin.MORE || Opcode == Opcode.CONT;
|
||||
return Fin == Fin.More || Opcode == Opcode.CONT;
|
||||
}
|
||||
}
|
||||
|
||||
@ -347,7 +347,7 @@ namespace WebSocketSharp
|
||||
|
||||
private static bool isFinal (Fin fin)
|
||||
{
|
||||
return fin == Fin.FINAL;
|
||||
return fin == Fin.Final;
|
||||
}
|
||||
|
||||
private static bool isMasked (Mask mask)
|
||||
@ -375,7 +375,7 @@ namespace WebSocketSharp
|
||||
/* Header */
|
||||
|
||||
// FIN
|
||||
var fin = (header [0] & 0x80) == 0x80 ? Fin.FINAL : Fin.MORE;
|
||||
var fin = (header [0] & 0x80) == 0x80 ? Fin.Final : Fin.More;
|
||||
// RSV1
|
||||
var rsv1 = (header [0] & 0x40) == 0x40 ? Rsv.ON : Rsv.OFF;
|
||||
// RSV2
|
||||
@ -390,7 +390,7 @@ namespace WebSocketSharp
|
||||
var payloadLen = (byte) (header [1] & 0x7f);
|
||||
|
||||
// Check if correct frame.
|
||||
var incorrect = isControl (opcode) && fin == Fin.MORE
|
||||
var incorrect = isControl (opcode) && fin == Fin.More
|
||||
? "A control frame is fragmented."
|
||||
: !isData (opcode) && rsv1 == Rsv.ON
|
||||
? "A non data frame is compressed."
|
||||
|
Loading…
Reference in New Issue
Block a user