[Modify] Polish it

This commit is contained in:
sta 2016-01-05 15:58:38 +09:00
parent 2086107aee
commit 509b2e9b20

View File

@ -1841,20 +1841,22 @@ namespace WebSocketSharp
}
try {
byte[] cached;
if (!cache.TryGetValue (_compression, out cached)) {
cached = new WebSocketFrame (
Fin.Final,
opcode,
data.Compress (_compression),
_compression != CompressionMethod.None,
false)
byte[] found;
if (!cache.TryGetValue (_compression, out found)) {
found =
new WebSocketFrame (
Fin.Final,
opcode,
data.Compress (_compression),
_compression != CompressionMethod.None,
false
)
.ToArray ();
cache.Add (_compression, cached);
cache.Add (_compression, found);
}
sendBytes (cached);
sendBytes (found);
}
catch (Exception ex) {
_logger.Error (ex.ToString ());