Branch Coverage

EVx.xs
Criterion Covered Total %
branch 85 196 43.3


line true false branch
37 2 3 while ((r = recv(websock_object->io.fd, buf, len, 0)) == -1 && errno == EINTR);
0 2 while ((r = recv(websock_object->io.fd, buf, len, 0)) == -1 && errno == EINTR);
38 2 3 if (r == -1) {
39 0 2 if (errno == EAGAIN || errno == EWOULDBLOCK) {
0 0 if (errno == EAGAIN || errno == EWOULDBLOCK) {
44 0 3 } else if (r == 0) { /* Unexpected EOF is also treated as an error */
56 3 3 if(flags & WSLAY_MSG_MORE) { sflags |= MSG_MORE; }
58 0 6 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);
59 0 6 if (r == -1) {
60 0 0 if(errno == EAGAIN || errno == EWOULDBLOCK) {
0 0 if(errno == EAGAIN || errno == EWOULDBLOCK) {
71 8 0 for (mg = SvMAGIC((SV*) hv); mg; mg = mg->mg_moremagic) {
72 8 0 if (mg->mg_type == PERL_MAGIC_ext && mg->mg_virtual == NULL) {
8 0 if (mg->mg_type == PERL_MAGIC_ext && mg->mg_virtual == NULL) {
82 0 3 if (cb = hv_fetch(websock_object->perl_callbacks , "genmask", 7, 0)) {
86 0 0 PUSHMARK(SP);
87 0 0 XPUSHs(sv_2mortal(newSViv(len)));
92 0 0 if (count != 1) { croak("Wslay - genmask callback returned bad value!\n"); }
95 0 0 char *source_buf = SvPV(data, souce_len);
96 0 0 if (souce_len) { memcpy(buf, source_buf, (souce_len < len ? souce_len : len)); }
98 0 0 FREETMPS;
103 12 3 for(; i < len; i++){ buf[i] = (char) rand(); }
109 0 3 if (!(cb = hv_fetch(((websocket_object*) data)->perl_callbacks, "on_frame_recv_start", 19, 0)) ) {
116 0 3 PUSHMARK(SP);
117 0 3 EXTEND(SP, 4);
124 3 0 FREETMPS;
130 0 3 if (!(cb = hv_fetch(((websocket_object*) data)->perl_callbacks, "on_frame_recv_chunk", 19, 0))) {
137 0 3 PUSHMARK(SP);
138 0 3 EXTEND(SP, 1);
142 3 0 FREETMPS;
148 0 3 if (!(cb = hv_fetch(((websocket_object*) data)->perl_callbacks, "on_frame_recv_end", 17, 0))) {
153 0 3 PUSHMARK(SP);
158 0 2 if (msg->opcode == 0x08) { return; } // on_close callback is for close messages
160 0 2 if (!(cb = hv_fetch(((websocket_object*) data)->perl_callbacks, "on_msg_recv", 11, 0))) {
165 2 0 if (!(msg->rsv & WSLAY_RSV1_BIT) && msg->opcode == 1) { SvUTF8_on(msg_data); }
1 1 if (!(msg->rsv & WSLAY_RSV1_BIT) && msg->opcode == 1) { SvUTF8_on(msg_data); }
169 0 2 PUSHMARK(SP);
170 0 2 EXTEND(SP, 4);
177 1 0 FREETMPS;
187 0 3 PUSHMARK(SP);
188 0 3 XPUSHs(sv_2mortal(newSViv(len)));
194 2 1 if (count == 1) {
197 1 0 } else if (count == 2) {
198 1 0 status = POPi;
204 3 0 char* source_buf = SvPV(data, souce_len);
205 2 1 if (souce_len) {
210 3 0 FREETMPS;
212 1 2 if (status == FRAGMENTED_EOF) {
215 0 2 } else if (status == FRAGMENTED_ERROR) {
232 2 0 if (cb = hv_fetch(websock_object->perl_callbacks, "on_close", 8, 0)) {
236 0 2 PUSHMARK(SP);
237 0 2 EXTEND(SP, 1);
241 2 0 FREETMPS;
248 3 3 if (revents & EV_READ) {
249 0 2 if (wslay_event_recv(websock_object->ctx)) {
254 3 2 if (revents & EV_WRITE) {
255 0 3 if (wslay_event_send(websock_object->ctx)) {
265 0 11 if (websock_object->read_stopped && websock_object->write_stopped) { return; }
0 0 if (websock_object->read_stopped && websock_object->write_stopped) { return; }
268 11 0 if (wslay_event_want_read(websock_object->ctx)) {
269 11 0 if (!websock_object->read_stopped) { events |= EV_READ; }
272 5 6 if (wslay_event_want_write(websock_object->ctx)) {
273 3 2 if (!websock_object->write_stopped) { events |= EV_WRITE; }
275 0 6 } else if (
276 0 0 websock_object->queue_wait_cb &&
280 0 0 PUSHMARK(SP);
285 0 0 if (wslay_event_want_write(websock_object->ctx)) {
286 0 0 if (!websock_object->write_stopped) { events |= EV_WRITE; }
291 11 0 if (events) {
294 0 0 } else if (!wanted_io) {
306 0 1 I_EV_API("Net::WebSocket::EVx");
1 0 I_EV_API("Net::WebSocket::EVx");
1 0 I_EV_API("Net::WebSocket::EVx");
0 1 I_EV_API("Net::WebSocket::EVx");
330 2 0 websock_object->callbacks.on_frame_recv_start_callback = hv_exists(object, "on_frame_recv_start", strlen("on_frame_recv_start")) ? on_frame_recv_start_callback : NULL;
331 2 0 websock_object->callbacks.on_frame_recv_chunk_callback = hv_exists(object, "on_frame_recv_chunk", strlen("on_frame_recv_chunk")) ? on_frame_recv_chunk_callback : NULL;
332 2 0 websock_object->callbacks.on_frame_recv_end_callback = hv_exists(object, "on_frame_recv_end", strlen("on_frame_recv_end")) ? on_frame_recv_end_callback : NULL;
333 2 0 websock_object->callbacks.on_msg_recv_callback = hv_exists(object, "on_msg_recv", strlen("on_msg_recv")) ? on_msg_recv_callback : NULL;
334 1 1 if (is_server
0 2 if (is_server
419 0 0 if (websock_object->queue_wait_cb) { SvREFCNT_dec(websock_object->queue_wait_cb); }
431 1 0 msg.msg = SvPV(data, len);
435 0 1 if (result == WSLAY_ERR_INVALID_ARGUMENT) { croak("Wslay queue_msg - WSLAY_ERR_INVALID_ARGUMENT"); }
436 0 1 if (result == WSLAY_ERR_NOMEM) { croak("Wslay queue_msg - WSLAY_ERR_NOMEM"); }
451 0 0 msg.msg = SvPV(data, len);
455 0 0 if (result == WSLAY_ERR_INVALID_ARGUMENT) { croak("Wslay queue_msg - WSLAY_ERR_INVALID_ARGUMENT"); }
456 0 0 if (result == WSLAY_ERR_NOMEM) { croak("Wslay queue_msg - WSLAY_ERR_NOMEM"); }
473 0 1 if (result == WSLAY_ERR_INVALID_ARGUMENT) { croak("Wslay queue_fragmented - WSLAY_ERR_INVALID_ARGUMENT"); }
474 0 1 if (result == WSLAY_ERR_NOMEM) { croak("Wslay queue_fragmented - WSLAY_ERR_NOMEM"); }
492 0 0 if (result == WSLAY_ERR_INVALID_ARGUMENT) { croak("Wslay queue_fragmented - WSLAY_ERR_INVALID_ARGUMENT"); }
493 0 0 if (result == WSLAY_ERR_NOMEM) { croak("Wslay queue_fragmented - WSLAY_ERR_NOMEM"); }
507 0 0 if (data) { reason = SvPV(data, reason_length); }
0 0 if (data) { reason = SvPV(data, reason_length); }
509 0 0 if (result == WSLAY_ERR_INVALID_ARGUMENT) {croak("Wslay send - WSLAY_ERR_INVALID_ARGUMENT"); }
510 0 0 if (result == WSLAY_ERR_NOMEM) { croak("Wslay send - WSLAY_ERR_NOMEM"); }
529 0 2 if (websock_object->queue_wait_cb) { SvREFCNT_dec(websock_object->queue_wait_cb); }
530 2 0 if (websock_object->ctx) { close_connection(websock_object); }