[Modify] Polish it
This commit is contained in:
parent
f398f7f05b
commit
847d78a6e8
@ -374,8 +374,10 @@ namespace WebSocketSharp.Net
|
|||||||
private string readLineFrom (byte[] buffer, int offset, int length, out int read)
|
private string readLineFrom (byte[] buffer, int offset, int length, out int read)
|
||||||
{
|
{
|
||||||
read = 0;
|
read = 0;
|
||||||
|
|
||||||
for (var i = offset; i < length && _lineState != LineState.Lf; i++) {
|
for (var i = offset; i < length && _lineState != LineState.Lf; i++) {
|
||||||
read++;
|
read++;
|
||||||
|
|
||||||
var b = buffer[i];
|
var b = buffer[i];
|
||||||
if (b == 13)
|
if (b == 13)
|
||||||
_lineState = LineState.Cr;
|
_lineState = LineState.Cr;
|
||||||
@ -385,15 +387,15 @@ namespace WebSocketSharp.Net
|
|||||||
_currentLine.Append ((char) b);
|
_currentLine.Append ((char) b);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_lineState == LineState.Lf) {
|
if (_lineState != LineState.Lf)
|
||||||
_lineState = LineState.None;
|
return null;
|
||||||
var line = _currentLine.ToString ();
|
|
||||||
_currentLine.Length = 0;
|
|
||||||
|
|
||||||
return line;
|
var line = _currentLine.ToString ();
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
_currentLine.Length = 0;
|
||||||
|
_lineState = LineState.None;
|
||||||
|
|
||||||
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeConnection ()
|
private void removeConnection ()
|
||||||
|
Loading…
Reference in New Issue
Block a user