line |
true |
false |
branch |
30
|
0 |
1030 |
assert(_state != State::DONE); |
35
|
465 |
565 |
if (_state == State::FIRST) { |
36
|
0 |
465 |
if (data == end) return false; |
46
|
576 |
454 |
if (_state == State::SECOND) { |
47
|
111 |
465 |
if (data == end) return false; |
55
|
495 |
424 |
if (_state == State::LENGTH) { |
56
|
335 |
160 |
if (_slen < 126) { |
61
|
12 |
148 |
else if (data == end) return false; |
62
|
139 |
9 |
else if (_slen == 126) { |
63
|
11 |
128 |
if (!parse_binary_number(_len16, data, end - data)) return false; |
69
|
7 |
2 |
if (!parse_binary_number(length, data, end - data)) return false; |
76
|
889 |
0 |
if (_state == State::MASK) { |
77
|
62 |
827 |
if (!has_mask) _state = State::DONE; |
78
|
106 |
721 |
else if (data == end) return false; |
80
|
318 |
403 |
if (!parse_binary_number(mask, data, end - data)) return false; |
86
|
135 |
330 |
if (data == end) buf.clear(); // no extra data after the end of frame |
87
|
330 |
0 |
else buf.offset(data - buf.data()); // leave rest in buffer |
94
|
234 |
0 |
char* ptr = ret.buf(); |
99
|
118 |
116 |
if (plen < 126) { |
101
|
114 |
2 |
} else if (plen < 65536) { |
111
|
122 |
112 |
if (has_mask) { |
121
|
0 |
31 |
if (!payload) code = (uint16_t)CloseCode::UNKNOWN; |
122
|
6 |
25 |
else if (payload.length() < sizeof(code)) { |
128
|
25 |
0 |
message = payload.substr(sizeof(code)); |
136
|
3 |
0 |
char* buf = ret.buf(); |
139
|
2 |
1 |
if (message.length()) std::memcpy(buf, message.data(), message.length()); |
144
|
18 |
0 |
}}} |
|
18 |
0 |
}}} |