| line |
true |
false |
branch |
|
39
|
7 |
8 |
while ((r = recv(websock_object->io.fd, buf, len, 0)) == -1 && errno == EINTR); |
|
|
0 |
7 |
while ((r = recv(websock_object->io.fd, buf, len, 0)) == -1 && errno == EINTR); |
|
40
|
7 |
8 |
if (r == -1) { |
|
41
|
0 |
7 |
if (errno == EAGAIN || errno == EWOULDBLOCK) { |
|
|
0 |
0 |
if (errno == EAGAIN || errno == EWOULDBLOCK) { |
|
46
|
0 |
8 |
} else if (r == 0) { /* Unexpected EOF is also treated as an error */ |
|
58
|
9 |
9 |
if(flags & WSLAY_MSG_MORE) { sflags |= MSG_MORE; } |
|
60
|
0 |
18 |
while ((r = send(websock_object->io.fd, buf, len, sflags)) == -1 && errno == EINTR); |
|
|
0 |
0 |
while ((r = send(websock_object->io.fd, buf, len, sflags)) == -1 && errno == EINTR); |
|
61
|
0 |
18 |
if (r == -1) { |
|
62
|
0 |
0 |
if(errno == EAGAIN || errno == EWOULDBLOCK) { |
|
|
0 |
0 |
if(errno == EAGAIN || errno == EWOULDBLOCK) { |
|
73
|
35 |
0 |
for (mg = SvMAGIC((SV*) hv); mg; mg = mg->mg_moremagic) { |
|
74
|
35 |
0 |
if (mg->mg_type == PERL_MAGIC_ext && mg->mg_virtual == NULL) { |
|
|
35 |
0 |
if (mg->mg_type == PERL_MAGIC_ext && mg->mg_virtual == NULL) { |
|
84
|
0 |
5 |
if ((cb = hv_fetch(websock_object->perl_callbacks , "genmask", 7, 0))) { |
|
92
|
0 |
0 |
PUSHMARK(SP); |
|
93
|
0 |
0 |
XPUSHs(sv_2mortal(newSViv(len))); |
|
97
|
0 |
0 |
if (count != 1) { croak("Wslay - genmask callback returned bad value!\n"); } |
|
100
|
0 |
0 |
if (source_len) { memcpy(buf, source_buf, (source_len < len ? source_len : len)); } |
|
102
|
0 |
0 |
FREETMPS; |
|
108
|
20 |
5 |
for(i = 0; i < len; i++){ buf[i] = (char) rand(); } |
|
115
|
4 |
4 |
if (!(cb = hv_fetch(((websocket_object*) data)->perl_callbacks, "on_frame_recv_start", 19, 0)) ) { |
|
121
|
0 |
4 |
PUSHMARK(SP); |
|
122
|
0 |
4 |
EXTEND(SP, 4); |
|
129
|
4 |
0 |
FREETMPS; |
|
135
|
4 |
4 |
if (!(cb = hv_fetch(((websocket_object*) data)->perl_callbacks, "on_frame_recv_chunk", 19, 0))) { |
|
141
|
0 |
4 |
PUSHMARK(SP); |
|
142
|
0 |
4 |
EXTEND(SP, 1); |
|
146
|
4 |
0 |
FREETMPS; |
|
152
|
4 |
4 |
if (!(cb = hv_fetch(((websocket_object*) data)->perl_callbacks, "on_frame_recv_end", 17, 0))) { |
|
158
|
0 |
4 |
PUSHMARK(SP); |
|
160
|
0 |
4 |
FREETMPS; |
|
167
|
1 |
6 |
if (msg->opcode == 0x08) { return; } |
|
168
|
0 |
6 |
if (!(cb = hv_fetch(((websocket_object*) data)->perl_callbacks, "on_msg_recv", 11, 0))) { |
|
172
|
5 |
1 |
if (!(msg->rsv & WSLAY_RSV1_BIT) && msg->opcode == 1) { SvUTF8_on(msg_data); } |
|
|
4 |
1 |
if (!(msg->rsv & WSLAY_RSV1_BIT) && msg->opcode == 1) { SvUTF8_on(msg_data); } |
|
176
|
0 |
6 |
PUSHMARK(SP); |
|
177
|
0 |
6 |
EXTEND(SP, 4); |
|
184
|
6 |
0 |
FREETMPS; |
|
199
|
0 |
3 |
PUSHMARK(SP); |
|
200
|
0 |
3 |
XPUSHs(sv_2mortal(newSViv(len))); |
|
204
|
2 |
1 |
if (count == 1) { |
|
207
|
1 |
0 |
} else if (count == 2) { |
|
214
|
2 |
1 |
if (source_len) { |
|
219
|
3 |
0 |
FREETMPS; |
|
221
|
1 |
2 |
if (status == FRAGMENTED_EOF) { |
|
224
|
0 |
2 |
} else if (status == FRAGMENTED_ERROR) { |
|
237
|
0 |
12 |
if (!websock_object->ctx) { return; } |
|
242
|
12 |
0 |
if (websock_object->io.fd >= 0) { |
|
246
|
12 |
0 |
if ((cb = hv_fetch(websock_object->perl_callbacks, "on_close", 8, 0))) { |
|
250
|
0 |
12 |
PUSHMARK(SP); |
|
251
|
0 |
12 |
EXTEND(SP, 1); |
|
255
|
12 |
0 |
FREETMPS; |
|
262
|
8 |
9 |
if (revents & EV_READ) { |
|
263
|
0 |
8 |
if (wslay_event_recv(websock_object->ctx)) { |
|
268
|
0 |
17 |
if (!websock_object->ctx) { return; } |
|
269
|
9 |
8 |
if (revents & EV_WRITE) { |
|
270
|
0 |
9 |
if (wslay_event_send(websock_object->ctx)) { |
|
282
|
0 |
39 |
if (websock_object->read_stopped && websock_object->write_stopped) { return; } |
|
|
0 |
0 |
if (websock_object->read_stopped && websock_object->write_stopped) { return; } |
|
283
|
35 |
4 |
if (wslay_event_want_read(websock_object->ctx)) { |
|
284
|
35 |
0 |
if (!websock_object->read_stopped) { events |= EV_READ; } |
|
287
|
12 |
27 |
if (wslay_event_want_write(websock_object->ctx)) { |
|
288
|
10 |
2 |
if (!websock_object->write_stopped) { events |= EV_WRITE; } |
|
301
|
0 |
1 |
PUSHMARK(SP); |
|
303
|
0 |
1 |
FREETMPS; |
|
308
|
1 |
0 |
if (websock_object->ctx && wslay_event_want_write(websock_object->ctx)) { |
|
|
0 |
1 |
if (websock_object->ctx && wslay_event_want_write(websock_object->ctx)) { |
|
309
|
0 |
0 |
if (!websock_object->write_stopped) { events |= EV_WRITE; } |
|
315
|
0 |
1 |
if (!ctx_alive) { return; } |
|
319
|
37 |
2 |
if (events) { |
|
322
|
2 |
0 |
} else if (!wanted_io && websock_object->ctx) { |
|
|
2 |
0 |
} else if (!wanted_io && websock_object->ctx) { |
|
334
|
0 |
1 |
I_EV_API("Net::WebSocket::EVx"); |
|
|
1 |
0 |
I_EV_API("Net::WebSocket::EVx"); |
|
|
0 |
1 |
I_EV_API("Net::WebSocket::EVx"); |
|
358
|
6 |
6 |
if (is_server |
|
|
0 |
12 |
if (is_server |
|
374
|
0 |
12 |
REQUIRE_CTX(websock_object); |
|
382
|
0 |
0 |
REQUIRE_CTX(websock_object); |
|
389
|
0 |
0 |
REQUIRE_CTX(websock_object); |
|
396
|
0 |
0 |
REQUIRE_CTX(websock_object); |
|
403
|
0 |
0 |
REQUIRE_CTX(websock_object); |
|
412
|
0 |
0 |
REQUIRE_CTX(websock_object); |
|
420
|
0 |
1 |
REQUIRE_CTX(websock_object); |
|
428
|
0 |
0 |
REQUIRE_CTX(websock_object); |
|
437
|
0 |
0 |
REQUIRE_CTX(websock_object); |
|
445
|
0 |
1 |
REQUIRE_CTX(websock_object); |
|
454
|
0 |
1 |
REQUIRE_CTX(websock_object); |
|
455
|
0 |
1 |
if (websock_object->queue_wait_cb) { SvREFCNT_dec(websock_object->queue_wait_cb); } |
|
466
|
0 |
4 |
REQUIRE_CTX(websock_object); |
|
473
|
0 |
4 |
if (result == WSLAY_ERR_INVALID_ARGUMENT) { croak("Wslay queue_msg - WSLAY_ERR_INVALID_ARGUMENT"); } |
|
474
|
0 |
4 |
if (result == WSLAY_ERR_NOMEM) { croak("Wslay queue_msg - WSLAY_ERR_NOMEM"); } |
|
476
|
0 |
4 |
RETVAL = result; |
|
487
|
0 |
1 |
REQUIRE_CTX(websock_object); |
|
494
|
0 |
1 |
if (result == WSLAY_ERR_INVALID_ARGUMENT) { croak("Wslay queue_msg_ex - WSLAY_ERR_INVALID_ARGUMENT"); } |
|
495
|
0 |
1 |
if (result == WSLAY_ERR_NOMEM) { croak("Wslay queue_msg_ex - WSLAY_ERR_NOMEM"); } |
|
497
|
0 |
1 |
RETVAL = result; |
|
507
|
0 |
1 |
REQUIRE_CTX(websock_object); |
|
513
|
0 |
1 |
if (result == WSLAY_ERR_INVALID_ARGUMENT) { SvREFCNT_dec(cb); croak("Wslay queue_fragmented - WSLAY_ERR_INVALID_ARGUMENT"); } |
|
514
|
0 |
1 |
if (result == WSLAY_ERR_NOMEM) { SvREFCNT_dec(cb); croak("Wslay queue_fragmented - WSLAY_ERR_NOMEM"); } |
|
515
|
0 |
1 |
if (result) { SvREFCNT_dec(cb); } |
|
517
|
0 |
1 |
RETVAL = result; |
|
528
|
0 |
0 |
REQUIRE_CTX(websock_object); |
|
534
|
0 |
0 |
if (result == WSLAY_ERR_INVALID_ARGUMENT) { SvREFCNT_dec(cb); croak("Wslay queue_fragmented_ex - WSLAY_ERR_INVALID_ARGUMENT"); } |
|
535
|
0 |
0 |
if (result == WSLAY_ERR_NOMEM) { SvREFCNT_dec(cb); croak("Wslay queue_fragmented_ex - WSLAY_ERR_NOMEM"); } |
|
536
|
0 |
0 |
if (result) { SvREFCNT_dec(cb); } |
|
538
|
0 |
0 |
RETVAL = result; |
|
548
|
0 |
1 |
REQUIRE_CTX(websock_object); |
|
551
|
0 |
1 |
if (data) { reason = SvPV(data, reason_length); } |
|
553
|
0 |
1 |
if (result == WSLAY_ERR_INVALID_ARGUMENT) {croak("Wslay close - WSLAY_ERR_INVALID_ARGUMENT"); } |
|
554
|
0 |
1 |
if (result == WSLAY_ERR_NOMEM) { croak("Wslay close - WSLAY_ERR_NOMEM"); } |
|
557
|
0 |
1 |
RETVAL = result; |
|
565
|
0 |
1 |
REQUIRE_CTX(websock_object); |
|
574
|
0 |
12 |
if (websock_object->queue_wait_cb) { SvREFCNT_dec(websock_object->queue_wait_cb); } |
|
575
|
10 |
2 |
if (websock_object->ctx) { close_connection(websock_object); } |