| line |
true |
false |
branch |
|
155
|
54 |
172 |
if (total > 0) { |
|
160
|
54 |
0 |
if (n > 0) { |
|
174
|
54 |
170 |
if (val && !hv_store(hv, name, nlen, val, 0)) |
|
|
0 |
54 |
if (val && !hv_store(hv, name, nlen, val, 0)) |
|
194
|
144 |
18 |
for (i = 0; i < N_REQUEST_HDRS; i++) |
|
207
|
1 |
1 |
while ((entry = hv_iternext(hv))) { |
|
213
|
0 |
1 |
if (klen >= 254) continue; |
|
219
|
0 |
1 |
if (lws_add_http_header_by_name(wsi, (unsigned char *)kbuf, |
|
239
|
24 |
255 |
if (--ctx->refcnt == 0) { |
|
259
|
3 |
276 |
if (delay_ms < 1) delay_ms = 1; |
|
268
|
5 |
0 |
if (ctx && ctx->magic == EV_WS_CTX_MAGIC && ctx->lws_ctx) { |
|
|
5 |
0 |
if (ctx && ctx->magic == EV_WS_CTX_MAGIC && ctx->lws_ctx) { |
|
|
5 |
0 |
if (ctx && ctx->magic == EV_WS_CTX_MAGIC && ctx->lws_ctx) { |
|
284
|
5 |
0 |
if (alive) { |
|
287
|
0 |
0 |
} else if (prev_flag) { |
|
307
|
89 |
42 |
if (conn->perl_self) { |
|
368
|
2 |
0 |
EMIT_BEGIN(conn, on_error); |
|
|
0 |
2 |
EMIT_BEGIN(conn, on_error); |
|
|
0 |
2 |
EMIT_BEGIN(conn, on_error); |
|
|
0 |
2 |
EMIT_BEGIN(conn, on_error); |
|
369
|
0 |
2 |
XPUSHs(sv_2mortal(newSVpv(error, 0))); |
|
370
|
2 |
0 |
EMIT_END(conn, "error handler"); |
|
|
2 |
0 |
EMIT_END(conn, "error handler"); |
|
|
0 |
2 |
EMIT_END(conn, "error handler"); |
|
|
0 |
0 |
EMIT_END(conn, "error handler"); |
|
|
2 |
0 |
EMIT_END(conn, "error handler"); |
|
374
|
38 |
0 |
EMIT_BEGIN(conn, on_connect); |
|
|
2 |
36 |
EMIT_BEGIN(conn, on_connect); |
|
|
0 |
36 |
EMIT_BEGIN(conn, on_connect); |
|
|
0 |
36 |
EMIT_BEGIN(conn, on_connect); |
|
375
|
36 |
0 |
if (conn->response_headers) |
|
376
|
0 |
36 |
XPUSHs(sv_2mortal(newRV_inc((SV*)conn->response_headers))); |
|
378
|
0 |
0 |
XPUSHs(&PL_sv_undef); |
|
379
|
36 |
0 |
EMIT_END(conn, "connect handler"); |
|
|
36 |
0 |
EMIT_END(conn, "connect handler"); |
|
|
1 |
35 |
EMIT_END(conn, "connect handler"); |
|
|
1 |
0 |
EMIT_END(conn, "connect handler"); |
|
|
36 |
0 |
EMIT_END(conn, "connect handler"); |
|
383
|
30 |
0 |
EMIT_BEGIN(conn, on_message); |
|
|
0 |
30 |
EMIT_BEGIN(conn, on_message); |
|
|
0 |
30 |
EMIT_BEGIN(conn, on_message); |
|
|
0 |
30 |
EMIT_BEGIN(conn, on_message); |
|
384
|
0 |
30 |
XPUSHs(sv_2mortal(newSVpvn(data, len))); |
|
385
|
0 |
30 |
XPUSHs(sv_2mortal(newSViv(is_binary))); |
|
386
|
0 |
30 |
XPUSHs(sv_2mortal(newSViv(is_final))); |
|
387
|
30 |
0 |
EMIT_END(conn, "message handler"); |
|
|
30 |
0 |
EMIT_END(conn, "message handler"); |
|
|
0 |
30 |
EMIT_END(conn, "message handler"); |
|
|
0 |
0 |
EMIT_END(conn, "message handler"); |
|
|
30 |
0 |
EMIT_END(conn, "message handler"); |
|
391
|
31 |
0 |
EMIT_BEGIN(conn, on_close); |
|
|
0 |
31 |
EMIT_BEGIN(conn, on_close); |
|
|
0 |
31 |
EMIT_BEGIN(conn, on_close); |
|
|
0 |
31 |
EMIT_BEGIN(conn, on_close); |
|
392
|
0 |
31 |
XPUSHs(sv_2mortal(newSViv(code))); |
|
393
|
0 |
31 |
XPUSHs(reason ? sv_2mortal(newSVpv(reason, 0)) : &PL_sv_undef); |
|
|
0 |
31 |
XPUSHs(reason ? sv_2mortal(newSVpv(reason, 0)) : &PL_sv_undef); |
|
394
|
31 |
0 |
EMIT_END(conn, "close handler"); |
|
|
31 |
0 |
EMIT_END(conn, "close handler"); |
|
|
1 |
30 |
EMIT_END(conn, "close handler"); |
|
|
1 |
0 |
EMIT_END(conn, "close handler"); |
|
|
31 |
0 |
EMIT_END(conn, "close handler"); |
|
398
|
3 |
0 |
EMIT_BEGIN(conn, on_pong); |
|
|
0 |
3 |
EMIT_BEGIN(conn, on_pong); |
|
|
0 |
3 |
EMIT_BEGIN(conn, on_pong); |
|
|
0 |
3 |
EMIT_BEGIN(conn, on_pong); |
|
399
|
0 |
3 |
XPUSHs(sv_2mortal(newSVpvn(data ? data : "", len))); |
|
|
3 |
0 |
XPUSHs(sv_2mortal(newSVpvn(data ? data : "", len))); |
|
400
|
3 |
0 |
EMIT_END(conn, "pong handler"); |
|
|
3 |
0 |
EMIT_END(conn, "pong handler"); |
|
|
1 |
2 |
EMIT_END(conn, "pong handler"); |
|
|
1 |
0 |
EMIT_END(conn, "pong handler"); |
|
|
3 |
0 |
EMIT_END(conn, "pong handler"); |
|
404
|
33 |
0 |
EMIT_BEGIN(conn, on_drain); |
|
|
32 |
1 |
EMIT_BEGIN(conn, on_drain); |
|
|
0 |
1 |
EMIT_BEGIN(conn, on_drain); |
|
|
0 |
1 |
EMIT_BEGIN(conn, on_drain); |
|
405
|
1 |
0 |
EMIT_END(conn, "drain handler"); |
|
|
1 |
0 |
EMIT_END(conn, "drain handler"); |
|
|
1 |
0 |
EMIT_END(conn, "drain handler"); |
|
|
1 |
0 |
EMIT_END(conn, "drain handler"); |
|
|
1 |
0 |
EMIT_END(conn, "drain handler"); |
|
410
|
0 |
112 |
if (conn->connect_timer_active && conn->loop) { |
|
|
0 |
0 |
if (conn->connect_timer_active && conn->loop) { |
|
422
|
0 |
5 |
if (on_connect) SvREFCNT_dec(on_connect); |
|
423
|
3 |
2 |
if (on_message) SvREFCNT_dec(on_message); |
|
424
|
0 |
5 |
if (on_close) SvREFCNT_dec(on_close); |
|
425
|
0 |
5 |
if (on_error) SvREFCNT_dec(on_error); |
|
426
|
0 |
5 |
if (on_pong) SvREFCNT_dec(on_pong); |
|
427
|
0 |
5 |
if (on_drain) SvREFCNT_dec(on_drain); |
|
428
|
0 |
5 |
if (on_handshake) SvREFCNT_dec(on_handshake); |
|
434
|
18 |
0 |
if (srv->on_connect) { SvREFCNT_dec(srv->on_connect); srv->on_connect = NULL; } |
|
435
|
17 |
1 |
if (srv->on_message) { SvREFCNT_dec(srv->on_message); srv->on_message = NULL; } |
|
436
|
17 |
1 |
if (srv->on_close) { SvREFCNT_dec(srv->on_close); srv->on_close = NULL; } |
|
437
|
2 |
16 |
if (srv->on_error) { SvREFCNT_dec(srv->on_error); srv->on_error = NULL; } |
|
438
|
1 |
17 |
if (srv->on_pong) { SvREFCNT_dec(srv->on_pong); srv->on_pong = NULL; } |
|
439
|
0 |
18 |
if (srv->on_drain) { SvREFCNT_dec(srv->on_drain); srv->on_drain = NULL; } |
|
440
|
0 |
18 |
if (srv->on_handshake) { SvREFCNT_dec(srv->on_handshake); srv->on_handshake = NULL; } |
|
441
|
0 |
18 |
if (srv->response_headers) { |
|
452
|
0 |
42 |
DEBUG_LOG("Freeing connection resources: conn=%p", conn); |
|
456
|
38 |
4 |
if (conn->on_connect) { SvREFCNT_dec(conn->on_connect); conn->on_connect = NULL; } |
|
457
|
32 |
10 |
if (conn->on_message) { SvREFCNT_dec(conn->on_message); conn->on_message = NULL; } |
|
458
|
37 |
5 |
if (conn->on_close) { SvREFCNT_dec(conn->on_close); conn->on_close = NULL; } |
|
459
|
26 |
16 |
if (conn->on_error) { SvREFCNT_dec(conn->on_error); conn->on_error = NULL; } |
|
460
|
3 |
39 |
if (conn->on_pong) { SvREFCNT_dec(conn->on_pong); conn->on_pong = NULL; } |
|
461
|
1 |
41 |
if (conn->on_drain) { SvREFCNT_dec(conn->on_drain); conn->on_drain = NULL; } |
|
463
|
1 |
41 |
if (conn->custom_headers) { |
|
468
|
38 |
4 |
if (conn->response_headers) { |
|
473
|
1 |
41 |
if (conn->stash) { SvREFCNT_dec((SV*)conn->stash); conn->stash = NULL; } |
|
475
|
1 |
41 |
if (conn->adopted_fh) { SvREFCNT_dec(conn->adopted_fh); conn->adopted_fh = NULL; } |
|
477
|
27 |
15 |
if (conn->recv_buf) { Safefree(conn->recv_buf); conn->recv_buf = NULL; conn->recv_alloc = 0; } |
|
479
|
0 |
42 |
for (send = conn->send_head; send != NULL; send = next_send) { |
|
490
|
0 |
209 |
DEBUG_LOG("conn_ref: %p refcnt=%d", conn, conn->refcnt); |
|
494
|
0 |
275 |
DEBUG_LOG("conn_unref: %p refcnt=%d", conn, conn->refcnt); |
|
495
|
42 |
233 |
if (--conn->refcnt == 0) { |
|
496
|
0 |
42 |
DEBUG_LOG("Actually freeing conn: %p", conn); |
|
506
|
19 |
23 |
if (ctx->connections) { |
|
513
|
0 |
32 |
if (conn->ctx == NULL) return; |
|
515
|
12 |
20 |
if (conn->prev) { |
|
520
|
7 |
25 |
if (conn->next) { |
|
533
|
36 |
0 |
if (data && len > 0) { |
|
|
36 |
0 |
if (data && len > 0) { |
|
540
|
2 |
34 |
if (conn->send_tail) { |
|
549
|
34 |
2 |
if (was_empty && conn->wsi) { |
|
|
34 |
0 |
if (was_empty && conn->wsi) { |
|
561
|
249 |
0 |
if (ctx == NULL || ctx->magic != EV_WS_CTX_MAGIC || ctx->lws_ctx == NULL) { |
|
|
249 |
0 |
if (ctx == NULL || ctx->magic != EV_WS_CTX_MAGIC || ctx->lws_ctx == NULL) { |
|
|
0 |
249 |
if (ctx == NULL || ctx->magic != EV_WS_CTX_MAGIC || ctx->lws_ctx == NULL) { |
|
569
|
115 |
134 |
if (revents & EV_READ) pollfd.revents |= POLLIN; |
|
570
|
143 |
106 |
if (revents & EV_WRITE) pollfd.revents |= POLLOUT; |
|
571
|
0 |
249 |
if (revents & EV_ERROR) pollfd.revents |= POLLERR | POLLHUP; |
|
579
|
249 |
0 |
if (alive) { |
|
582
|
0 |
0 |
} else if (prev_flag) { |
|
592
|
0 |
23 |
int new_size = ctx->fd_table_size ? ctx->fd_table_size : FD_TABLE_INIT_SIZE; |
|
593
|
0 |
23 |
while (new_size <= needed) new_size *= 2; |
|
603
|
0 |
60 |
if (fd < 0) return; |
|
604
|
23 |
37 |
if (fd >= ctx->fd_table_size) fd_table_grow(ctx, fd); |
|
607
|
0 |
60 |
if (fdw != NULL) { |
|
617
|
60 |
0 |
if (events & POLLIN) ev_events |= EV_READ; |
|
618
|
0 |
60 |
if (events & POLLOUT) ev_events |= EV_WRITE; |
|
620
|
0 |
60 |
DEBUG_LOG("add_fd_watcher: fd=%d poll_events=%d ev_events=%d", fd, events, ev_events); |
|
622
|
60 |
0 |
ev_io_init(&fdw->io, io_cb, fd, ev_events ? ev_events : EV_READ); |
|
623
|
60 |
0 |
if (ev_events) |
|
631
|
32 |
0 |
if (fd < 0 || fd >= ctx->fd_table_size) return; |
|
|
0 |
32 |
if (fd < 0 || fd >= ctx->fd_table_size) return; |
|
633
|
0 |
32 |
if (fdw == NULL) return; |
|
644
|
0 |
393 |
if (fd < 0) return; |
|
645
|
0 |
393 |
if (fd >= ctx->fd_table_size) { |
|
650
|
0 |
393 |
if (fdw == NULL) { |
|
657
|
382 |
11 |
if (events & POLLIN) ev_events |= EV_READ; |
|
658
|
133 |
260 |
if (events & POLLOUT) ev_events |= EV_WRITE; |
|
660
|
0 |
393 |
DEBUG_LOG("change_fd_watcher: fd=%d poll_events=%d ev_events=%d", fd, events, ev_events); |
|
663
|
6 |
387 |
if (ev_events == 0) return; |
|
670
|
1472 |
24 |
for (i = 0; i < ctx->fd_table_size; i++) { |
|
672
|
28 |
1444 |
if (fdw) { |
|
673
|
28 |
0 |
if (ctx->loop) ev_io_stop(ctx->loop, &fdw->io); |
|
690
|
0 |
0 |
if (conn->magic == EV_WS_CONN_MAGIC && conn->wsi) |
|
|
0 |
0 |
if (conn->magic == EV_WS_CONN_MAGIC && conn->wsi) |
|
698
|
2190 |
0 |
struct lws_context* lws_ctx = wsi ? lws_get_context(wsi) : NULL; |
|
699
|
2190 |
0 |
ev_ws_ctx_t* ctx = lws_ctx ? (ev_ws_ctx_t*)lws_context_user(lws_ctx) : NULL; |
|
702
|
679 |
1511 |
if (!conn && wsi && pending_adoption) { |
|
|
679 |
0 |
if (!conn && wsi && pending_adoption) { |
|
|
1 |
678 |
if (!conn && wsi && pending_adoption) { |
|
703
|
0 |
1 |
DEBUG_LOG("Associating pending adoption: conn=%p", pending_adoption); |
|
706
|
1 |
0 |
if (!conn->wsi) conn->wsi = wsi; |
|
709
|
2173 |
17 |
if (ctx && ctx->magic != EV_WS_CTX_MAGIC) { |
|
|
221 |
1952 |
if (ctx && ctx->magic != EV_WS_CTX_MAGIC) { |
|
711
|
193 |
28 |
if (reason != LWS_CALLBACK_WSI_DESTROY && |
|
|
150 |
43 |
if (reason != LWS_CALLBACK_WSI_DESTROY && |
|
717
|
0 |
2040 |
DEBUG_LOG("callback reason=%d user=%p ctx=%p wsi=%p conn=%p", (int)reason, user, ctx, wsi, conn); |
|
723
|
0 |
60 |
DEBUG_LOG("ADD_POLL_FD: ctx=%p fd=%d events=%d", ctx, pa->fd, pa->events); |
|
724
|
60 |
0 |
if (ctx && ctx->magic == EV_WS_CTX_MAGIC) { |
|
|
60 |
0 |
if (ctx && ctx->magic == EV_WS_CTX_MAGIC) { |
|
732
|
32 |
0 |
if (ctx && ctx->magic == EV_WS_CTX_MAGIC) { |
|
|
32 |
0 |
if (ctx && ctx->magic == EV_WS_CTX_MAGIC) { |
|
740
|
393 |
0 |
if (ctx && ctx->magic == EV_WS_CTX_MAGIC) { |
|
|
393 |
0 |
if (ctx && ctx->magic == EV_WS_CTX_MAGIC) { |
|
747
|
21 |
0 |
if (conn && conn->custom_headers) { |
|
|
1 |
20 |
if (conn && conn->custom_headers) { |
|
750
|
0 |
1 |
if (inject_headers(wsi, conn->custom_headers, p, end)) |
|
757
|
20 |
0 |
if (conn && conn->magic == EV_WS_CONN_MAGIC) { |
|
|
20 |
0 |
if (conn && conn->magic == EV_WS_CONN_MAGIC) { |
|
771
|
20 |
0 |
if (!conn->response_headers) conn->response_headers = newHV(); |
|
772
|
80 |
20 |
for (hi = 0; hi < (int)(sizeof(resp_hdrs)/sizeof(resp_hdrs[0])); hi++) { |
|
782
|
18 |
0 |
ev_ws_server_t *srv = vh ? (ev_ws_server_t *)lws_get_vhost_user(vh) : NULL; |
|
783
|
18 |
0 |
if (srv && srv->magic == EV_WS_SRV_MAGIC && srv->on_handshake) { |
|
|
18 |
0 |
if (srv && srv->magic == EV_WS_SRV_MAGIC && srv->on_handshake) { |
|
|
0 |
18 |
if (srv && srv->magic == EV_WS_SRV_MAGIC && srv->on_handshake) { |
|
792
|
0 |
0 |
PUSHMARK(SP); |
|
793
|
0 |
0 |
XPUSHs(sv_2mortal(newRV_noinc((SV*)hdrs))); |
|
795
|
0 |
0 |
sv_setsv(ERRSV, &PL_sv_undef); |
|
798
|
0 |
0 |
if (SvTRUE(ERRSV)) { |
|
|
0 |
0 |
if (SvTRUE(ERRSV)) { |
|
799
|
0 |
0 |
warn("EV::Websockets: exception in on_handshake: %s", SvPV_nolen(ERRSV)); |
|
800
|
0 |
0 |
if (count) POPs; |
|
802
|
0 |
0 |
FREETMPS; |
|
806
|
0 |
0 |
result = count ? POPs : &PL_sv_undef; |
|
807
|
0 |
0 |
if (!SvTRUE(result)) { |
|
809
|
0 |
0 |
FREETMPS; |
|
813
|
0 |
0 |
if (SvROK(result) && SvTYPE(SvRV(result)) == SVt_PVHV) { |
|
|
0 |
0 |
if (SvROK(result) && SvTYPE(SvRV(result)) == SVt_PVHV) { |
|
817
|
0 |
0 |
if (!handshake_headers_map) |
|
819
|
0 |
0 |
if (!hv_store(handshake_headers_map, key, klen, val, 0)) |
|
823
|
0 |
0 |
FREETMPS; |
|
831
|
18 |
0 |
if (!conn) { |
|
833
|
18 |
0 |
ev_ws_server_t *srv = vh ? (ev_ws_server_t *)lws_get_vhost_user(vh) : NULL; |
|
834
|
18 |
0 |
if (ctx && srv && srv->magic == EV_WS_SRV_MAGIC) { |
|
|
18 |
0 |
if (ctx && srv && srv->magic == EV_WS_SRV_MAGIC) { |
|
|
18 |
0 |
if (ctx && srv && srv->magic == EV_WS_SRV_MAGIC) { |
|
843
|
18 |
0 |
c->on_connect = srv->on_connect ? SvREFCNT_inc(srv->on_connect) : NULL; |
|
844
|
16 |
2 |
c->on_message = srv->on_message ? SvREFCNT_inc(srv->on_message) : NULL; |
|
845
|
18 |
0 |
c->on_close = srv->on_close ? SvREFCNT_inc(srv->on_close) : NULL; |
|
846
|
2 |
16 |
c->on_error = srv->on_error ? SvREFCNT_inc(srv->on_error) : NULL; |
|
847
|
1 |
17 |
c->on_pong = srv->on_pong ? SvREFCNT_inc(srv->on_pong) : NULL; |
|
848
|
0 |
18 |
c->on_drain = srv->on_drain ? SvREFCNT_inc(srv->on_drain) : NULL; |
|
859
|
38 |
0 |
if (conn && conn->magic == EV_WS_CONN_MAGIC) { |
|
|
38 |
0 |
if (conn && conn->magic == EV_WS_CONN_MAGIC) { |
|
860
|
0 |
38 |
DEBUG_LOG("Connected (reason %d): conn=%p", (int)reason, conn); |
|
871
|
18 |
0 |
ev_ws_server_t *srv = vh ? (ev_ws_server_t *)lws_get_vhost_user(vh) : NULL; |
|
872
|
18 |
0 |
if (srv && srv->magic == EV_WS_SRV_MAGIC && srv->response_headers) |
|
|
18 |
0 |
if (srv && srv->magic == EV_WS_SRV_MAGIC && srv->response_headers) |
|
|
0 |
18 |
if (srv && srv->magic == EV_WS_SRV_MAGIC && srv->response_headers) |
|
875
|
0 |
18 |
if (handshake_headers_map) { |
|
879
|
0 |
0 |
if (val && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVHV) |
|
|
0 |
0 |
if (val && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVHV) |
|
|
0 |
0 |
if (val && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVHV) |
|
887
|
3 |
0 |
if (conn && conn->magic == EV_WS_CONN_MAGIC) { |
|
|
3 |
0 |
if (conn && conn->magic == EV_WS_CONN_MAGIC) { |
|
894
|
33 |
0 |
if (conn && conn->magic == EV_WS_CONN_MAGIC) { |
|
|
33 |
0 |
if (conn && conn->magic == EV_WS_CONN_MAGIC) { |
|
897
|
0 |
33 |
DEBUG_LOG("Received data (reason %d): len=%zu final=%d binary=%d", (int)reason, len, is_final, is_binary); |
|
899
|
31 |
2 |
if (lws_is_first_fragment(wsi)) { |
|
905
|
3 |
30 |
if (conn->max_message_size > 0 && conn->recv_len + len > conn->max_message_size) { |
|
|
1 |
2 |
if (conn->max_message_size > 0 && conn->recv_len + len > conn->max_message_size) { |
|
908
|
1 |
0 |
if (conn->magic == EV_WS_CONN_MAGIC) { |
|
919
|
28 |
4 |
if (conn->recv_len + len > conn->recv_alloc) { |
|
920
|
0 |
28 |
size_t new_alloc = conn->recv_alloc ? conn->recv_alloc * 2 : 4096; |
|
921
|
0 |
28 |
while (new_alloc < conn->recv_len + len) new_alloc *= 2; |
|
922
|
2 |
26 |
if (conn->max_message_size > 0 && new_alloc > conn->max_message_size) |
|
|
2 |
0 |
if (conn->max_message_size > 0 && new_alloc > conn->max_message_size) |
|
927
|
32 |
0 |
if (len) /* guard: recv_buf may still be NULL for an empty frame */ |
|
931
|
30 |
2 |
if (is_final) { |
|
934
|
30 |
0 |
if (conn->magic == EV_WS_CONN_MAGIC) |
|
943
|
69 |
0 |
if (conn && conn->magic == EV_WS_CONN_MAGIC) { |
|
|
69 |
0 |
if (conn && conn->magic == EV_WS_CONN_MAGIC) { |
|
946
|
36 |
69 |
while (conn->send_head) { |
|
948
|
0 |
36 |
DEBUG_LOG("Writing data: len=%zu mode=%d", send->len, (int)send->write_mode); |
|
951
|
0 |
36 |
if (n < 0) { |
|
965
|
34 |
2 |
if (conn->send_head == NULL) { |
|
971
|
0 |
36 |
if (lws_send_pipe_choked(wsi)) { |
|
976
|
36 |
33 |
if (conn->closing && conn->send_head == NULL) { |
|
|
36 |
0 |
if (conn->closing && conn->send_head == NULL) { |
|
977
|
0 |
36 |
DEBUG_LOG("Closing connection via writeable callback"); |
|
980
|
33 |
0 |
if (conn->send_head == NULL) { |
|
987
|
0 |
1 |
DEBUG_LOG("CLIENT_CONNECTION_ERROR: conn=%p", conn); |
|
988
|
1 |
0 |
if (conn && conn->magic == EV_WS_CONN_MAGIC) { |
|
|
1 |
0 |
if (conn && conn->magic == EV_WS_CONN_MAGIC) { |
|
989
|
1 |
0 |
const char* err = in ? (const char*)in : "connection error"; |
|
1007
|
0 |
31 |
DEBUG_LOG("CLOSED: conn=%p", conn); |
|
1008
|
31 |
0 |
if (conn && conn->magic == EV_WS_CONN_MAGIC) { |
|
|
31 |
0 |
if (conn && conn->magic == EV_WS_CONN_MAGIC) { |
|
1014
|
0 |
31 |
if (in && len >= 2) { |
|
|
0 |
0 |
if (in && len >= 2) { |
|
1016
|
0 |
0 |
if (len > 2) { |
|
1018
|
0 |
0 |
if (rlen > sizeof(reason_buf) - 1) rlen = sizeof(reason_buf) - 1; |
|
1025
|
0 |
31 |
DEBUG_LOG("Emitting close: code=%d", close_code); |
|
1038
|
43 |
0 |
struct lws_vhost *vh = wsi ? lws_get_vhost(wsi) : NULL; |
|
1039
|
43 |
0 |
if (vh) { |
|
1041
|
42 |
1 |
if (srv && (srv->magic == EV_WS_SRV_MAGIC || srv->magic == EV_WS_SRV_FREED)) { |
|
|
24 |
18 |
if (srv && (srv->magic == EV_WS_SRV_MAGIC || srv->magic == EV_WS_SRV_FREED)) { |
|
|
0 |
24 |
if (srv && (srv->magic == EV_WS_SRV_MAGIC || srv->magic == EV_WS_SRV_FREED)) { |
|
1045
|
18 |
0 |
if (srv->magic == EV_WS_SRV_MAGIC) |
|
1047
|
0 |
18 |
if (srv->protocol_name) Safefree(srv->protocol_name); |
|
1055
|
0 |
60 |
if (handshake_headers_map) { |
|
1060
|
0 |
60 |
if (conn && conn->magic == EV_WS_CONN_MAGIC) { |
|
|
0 |
0 |
if (conn && conn->magic == EV_WS_CONN_MAGIC) { |
|
1061
|
0 |
0 |
DEBUG_LOG("WSI destroyed: conn=%p", conn); |
|
1108
|
7 |
17 |
if (ssl_keepalive_ctx) |
|
1124
|
0 |
20 |
I_EV_API("EV::Websockets"); |
|
|
20 |
0 |
I_EV_API("EV::Websockets"); |
|
|
0 |
20 |
I_EV_API("EV::Websockets"); |
|
1133
|
0 |
0 |
if (enable) |
|
1171
|
24 |
0 |
if (ssl_init != 0) { |
|
1179
|
24 |
0 |
if (proxy && strlen(proxy) > 0) { |
|
|
0 |
24 |
if (proxy && strlen(proxy) > 0) { |
|
1180
|
0 |
0 |
DEBUG_LOG("Context using proxy: %s:%d", proxy, proxy_port); |
|
1185
|
24 |
0 |
if (ssl_cert && strlen(ssl_cert) > 0) { |
|
|
0 |
24 |
if (ssl_cert && strlen(ssl_cert) > 0) { |
|
1188
|
0 |
0 |
if (ssl_ca && strlen(ssl_ca) > 0) |
|
|
0 |
0 |
if (ssl_ca && strlen(ssl_ca) > 0) |
|
1192
|
0 |
24 |
DEBUG_LOG("Creating context (manual integration)"); |
|
1195
|
0 |
24 |
if (RETVAL->lws_ctx == NULL) { |
|
1204
|
0 |
24 |
DEBUG_LOG("Context created successfully"); |
|
1216
|
0 |
24 |
if (self->magic != EV_WS_CTX_MAGIC) return; |
|
1225
|
10 |
24 |
for (conn = self->connections; conn != NULL; conn = next) { |
|
1230
|
10 |
0 |
if (conn->wsi) { |
|
1238
|
24 |
0 |
if (self->lws_ctx) { |
|
1244
|
0 |
24 |
if (self->alive_flag) *self->alive_flag = 0; |
|
1271
|
25 |
0 |
double connect_timeout = 0; |
|
1275
|
0 |
25 |
if (self->magic != EV_WS_CTX_MAGIC) { |
|
1279
|
105 |
25 |
for (i = 1; i < items; i += 2) { |
|
1280
|
0 |
105 |
if (i + 1 >= items) break; |
|
1284
|
24 |
81 |
if (strcmp(key, "url") == 0) { |
|
1286
|
0 |
81 |
} else if (strcmp(key, "protocol") == 0) { |
|
1288
|
0 |
81 |
} else if (strcmp(key, "ssl_verify") == 0) { |
|
1290
|
0 |
81 |
} else if (strcmp(key, "max_message_size") == 0) { |
|
1292
|
0 |
81 |
} else if (strcmp(key, "connect_timeout") == 0) { |
|
1294
|
1 |
80 |
} else if (strcmp(key, "headers") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVHV) { |
|
|
1 |
0 |
} else if (strcmp(key, "headers") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVHV) { |
|
|
1 |
0 |
} else if (strcmp(key, "headers") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVHV) { |
|
1296
|
19 |
61 |
} else if (strcmp(key, "on_connect") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
19 |
0 |
} else if (strcmp(key, "on_connect") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
19 |
0 |
} else if (strcmp(key, "on_connect") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
1298
|
16 |
45 |
} else if (strcmp(key, "on_message") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
16 |
0 |
} else if (strcmp(key, "on_message") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
16 |
0 |
} else if (strcmp(key, "on_message") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
1300
|
19 |
26 |
} else if (strcmp(key, "on_close") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
19 |
0 |
} else if (strcmp(key, "on_close") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
19 |
0 |
} else if (strcmp(key, "on_close") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
1302
|
23 |
3 |
} else if (strcmp(key, "on_error") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
23 |
0 |
} else if (strcmp(key, "on_error") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
23 |
0 |
} else if (strcmp(key, "on_error") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
1304
|
2 |
1 |
} else if (strcmp(key, "on_pong") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
2 |
0 |
} else if (strcmp(key, "on_pong") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
2 |
0 |
} else if (strcmp(key, "on_pong") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
1306
|
1 |
0 |
} else if (strcmp(key, "on_drain") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
1 |
0 |
} else if (strcmp(key, "on_drain") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
1 |
0 |
} else if (strcmp(key, "on_drain") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
1311
|
1 |
24 |
if (url == NULL) { |
|
1319
|
0 |
24 |
if (strncasecmp(url_copy, "wss://", 6) == 0) { |
|
1321
|
0 |
0 |
if (!ssl_verify) { |
|
1328
|
23 |
1 |
} else if (strncasecmp(url_copy, "ws://", 5) == 0) { |
|
1337
|
0 |
23 |
if (path_start) { |
|
1348
|
0 |
23 |
if (host[0] == '[') { |
|
1350
|
0 |
0 |
if (p) { |
|
1354
|
0 |
0 |
if (*(p + 1) == ':') { |
|
1360
|
0 |
0 |
if (hport && hport != (use_ssl ? 443 : 80)) |
|
|
0 |
0 |
if (hport && hport != (use_ssl ? 443 : 80)) |
|
|
0 |
0 |
if (hport && hport != (use_ssl ? 443 : 80)) |
|
1367
|
23 |
0 |
if (p) { |
|
1392
|
0 |
23 |
ccinfo.host = host_header ? host_header : host; |
|
1393
|
0 |
23 |
ccinfo.origin = host_header ? host_header : host; |
|
1401
|
1 |
22 |
if (headers_hv) { |
|
1411
|
0 |
23 |
if (RETVAL->wsi == NULL) { |
|
1413
|
0 |
0 |
if (RETVAL->perl_self == NULL) { |
|
1424
|
0 |
23 |
if (connect_timeout > 0) { |
|
1452
|
19 |
0 |
const char *protocol_name = NULL; |
|
1458
|
0 |
19 |
if (self->magic != EV_WS_CTX_MAGIC) { |
|
1462
|
77 |
19 |
for (i = 1; i < items; i += 2) { |
|
1463
|
0 |
77 |
if (i + 1 >= items) break; |
|
1467
|
19 |
58 |
if (strcmp(key, "port") == 0) { |
|
1469
|
1 |
57 |
} else if (strcmp(key, "name") == 0) { |
|
1471
|
0 |
57 |
} else if (strcmp(key, "protocol") == 0) { |
|
1473
|
0 |
57 |
} else if (strcmp(key, "ssl_cert") == 0) { |
|
1475
|
0 |
57 |
} else if (strcmp(key, "ssl_key") == 0) { |
|
1477
|
0 |
57 |
} else if (strcmp(key, "ssl_ca") == 0) { |
|
1479
|
2 |
55 |
} else if (strcmp(key, "max_message_size") == 0) { |
|
1481
|
0 |
55 |
} else if (strcmp(key, "headers") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVHV) { |
|
|
0 |
0 |
} else if (strcmp(key, "headers") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVHV) { |
|
|
0 |
0 |
} else if (strcmp(key, "headers") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVHV) { |
|
1483
|
18 |
37 |
} else if (strcmp(key, "on_connect") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
18 |
0 |
} else if (strcmp(key, "on_connect") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
18 |
0 |
} else if (strcmp(key, "on_connect") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
1485
|
17 |
20 |
} else if (strcmp(key, "on_message") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
17 |
0 |
} else if (strcmp(key, "on_message") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
17 |
0 |
} else if (strcmp(key, "on_message") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
1487
|
17 |
3 |
} else if (strcmp(key, "on_close") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
17 |
0 |
} else if (strcmp(key, "on_close") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
17 |
0 |
} else if (strcmp(key, "on_close") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
1489
|
2 |
1 |
} else if (strcmp(key, "on_error") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
2 |
0 |
} else if (strcmp(key, "on_error") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
2 |
0 |
} else if (strcmp(key, "on_error") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
1491
|
1 |
0 |
} else if (strcmp(key, "on_pong") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
1 |
0 |
} else if (strcmp(key, "on_pong") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
1 |
0 |
} else if (strcmp(key, "on_pong") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
1493
|
0 |
0 |
} else if (strcmp(key, "on_drain") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
0 |
0 |
} else if (strcmp(key, "on_drain") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
0 |
0 |
} else if (strcmp(key, "on_drain") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
1495
|
0 |
0 |
} else if (strcmp(key, "on_handshake") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
0 |
0 |
} else if (strcmp(key, "on_handshake") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
0 |
0 |
} else if (strcmp(key, "on_handshake") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
1500
|
1 |
18 |
if (strcmp(name, "default") == 0) { |
|
1515
|
0 |
18 |
if (headers_hv) |
|
1518
|
0 |
18 |
if (protocol_name) { |
|
1529
|
0 |
18 |
info.protocols = srv->protocol_name ? srv->vhost_protocols : protocols; |
|
1534
|
0 |
18 |
if (ssl_cert && ssl_key) { |
|
|
0 |
0 |
if (ssl_cert && ssl_key) { |
|
1537
|
0 |
0 |
if (ssl_ca) |
|
1544
|
0 |
18 |
if (vh == NULL) { |
|
1546
|
0 |
0 |
if (srv->protocol_name) Safefree(srv->protocol_name); |
|
1552
|
0 |
18 |
if (RETVAL <= 0) { |
|
1563
|
0 |
18 |
DEBUG_LOG("Server listening on port %d", RETVAL); |
|
1580
|
3 |
0 |
size_t max_message_size = 0; |
|
1584
|
0 |
3 |
if (self->magic != EV_WS_CTX_MAGIC) { |
|
1588
|
7 |
3 |
for (i = 1; i < items; i += 2) { |
|
1589
|
0 |
7 |
if (i + 1 >= items) break; |
|
1593
|
2 |
5 |
if (strcmp(key, "fh") == 0) { |
|
1595
|
0 |
5 |
} else if (strcmp(key, "initial_data") == 0) { |
|
1597
|
0 |
5 |
} else if (strcmp(key, "max_message_size") == 0) { |
|
1599
|
1 |
4 |
} else if (strcmp(key, "on_connect") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
1 |
0 |
} else if (strcmp(key, "on_connect") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
1 |
0 |
} else if (strcmp(key, "on_connect") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
1601
|
3 |
1 |
} else if (strcmp(key, "on_message") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
3 |
0 |
} else if (strcmp(key, "on_message") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
3 |
0 |
} else if (strcmp(key, "on_message") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
1603
|
0 |
1 |
} else if (strcmp(key, "on_close") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
0 |
0 |
} else if (strcmp(key, "on_close") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
0 |
0 |
} else if (strcmp(key, "on_close") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
1605
|
1 |
0 |
} else if (strcmp(key, "on_error") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
1 |
0 |
} else if (strcmp(key, "on_error") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
1 |
0 |
} else if (strcmp(key, "on_error") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
1607
|
0 |
0 |
} else if (strcmp(key, "on_pong") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
0 |
0 |
} else if (strcmp(key, "on_pong") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
0 |
0 |
} else if (strcmp(key, "on_pong") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
1609
|
0 |
0 |
} else if (strcmp(key, "on_drain") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
0 |
0 |
} else if (strcmp(key, "on_drain") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
|
0 |
0 |
} else if (strcmp(key, "on_drain") == 0 && SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
|
1614
|
1 |
2 |
if (fh_sv == NULL) { |
|
1620
|
2 |
0 |
PerlIO *ifp = io ? IoIFP(io) : NULL; |
|
1621
|
1 |
1 |
if (!ifp || (fd = PerlIO_fileno(ifp)) < 0) { |
|
|
0 |
1 |
if (!ifp || (fd = PerlIO_fileno(ifp)) < 0) { |
|
1642
|
1 |
0 |
: SvREFCNT_inc(fh_sv); |
|
1648
|
1 |
0 |
if (!vh) { |
|
1657
|
0 |
1 |
if (!vh) { |
|
1665
|
0 |
1 |
if (initial_data_sv && SvOK(initial_data_sv)) { |
|
|
0 |
0 |
if (initial_data_sv && SvOK(initial_data_sv)) { |
|
1676
|
0 |
1 |
if (RETVAL->wsi == NULL) { |
|
1678
|
0 |
0 |
if (RETVAL->perl_self == NULL) { |
|
1703
|
1 |
0 |
if (alive) { |
|
1706
|
0 |
0 |
} else if (prev_flag) { |
|
1714
|
0 |
1 |
if (rejected) |
|
1726
|
0 |
2 |
if (self->magic != EV_WS_CTX_MAGIC) XSRETURN_EMPTY; |
|
1727
|
6 |
2 |
for (conn = self->connections; conn != NULL; conn = conn->next) { |
|
1731
|
6 |
0 |
if (conn->magic == EV_WS_CONN_MAGIC && conn->connected) { |
|
|
4 |
2 |
if (conn->magic == EV_WS_CONN_MAGIC && conn->connected) { |
|
1732
|
0 |
4 |
XPUSHs(sv_2mortal(get_conn_sv(conn))); |
|
1743
|
0 |
42 |
if (self->magic != EV_WS_CONN_MAGIC) return; |
|
1745
|
0 |
42 |
DEBUG_LOG("Perl object DESTROY: self=%p wsi=%p", self, self->wsi); |
|
1760
|
0 |
28 |
CHECK_CONN_OPEN(self); |
|
|
28 |
0 |
CHECK_CONN_OPEN(self); |
|
|
28 |
0 |
CHECK_CONN_OPEN(self); |
|
|
0 |
28 |
CHECK_CONN_OPEN(self); |
|
1761
|
1 |
27 |
CHECK_NOT_FRAGMENTING(self); |
|
1774
|
0 |
4 |
CHECK_CONN_OPEN(self); |
|
|
4 |
0 |
CHECK_CONN_OPEN(self); |
|
|
4 |
0 |
CHECK_CONN_OPEN(self); |
|
|
0 |
4 |
CHECK_CONN_OPEN(self); |
|
1775
|
1 |
3 |
CHECK_NOT_FRAGMENTING(self); |
|
1788
|
0 |
3 |
CHECK_CONN_OPEN(self); |
|
|
3 |
0 |
CHECK_CONN_OPEN(self); |
|
|
3 |
0 |
CHECK_CONN_OPEN(self); |
|
|
0 |
3 |
CHECK_CONN_OPEN(self); |
|
1790
|
3 |
0 |
if (data && SvOK(data)) { |
|
|
3 |
0 |
if (data && SvOK(data)) { |
|
1792
|
0 |
3 |
if (len > 125) len = 125; /* PING payload limit */ |
|
1803
|
2 |
0 |
if (self->magic == EV_WS_CONN_MAGIC && self->wsi) |
|
|
2 |
0 |
if (self->magic == EV_WS_CONN_MAGIC && self->wsi) |
|
1805
|
2 |
0 |
RETVAL = val ? val : newSV(0); |
|
1817
|
2 |
0 |
if (self->magic == EV_WS_CONN_MAGIC && self->wsi) { |
|
|
2 |
0 |
if (self->magic == EV_WS_CONN_MAGIC && self->wsi) { |
|
1819
|
2 |
0 |
if (buf[0]) |
|
1833
|
0 |
1 |
CHECK_CONN_OPEN(self); |
|
|
1 |
0 |
CHECK_CONN_OPEN(self); |
|
|
1 |
0 |
CHECK_CONN_OPEN(self); |
|
|
0 |
1 |
CHECK_CONN_OPEN(self); |
|
1835
|
1 |
0 |
if (data && SvOK(data)) { |
|
|
1 |
0 |
if (data && SvOK(data)) { |
|
1837
|
0 |
1 |
if (len > 125) len = 125; |
|
1847
|
1 |
0 |
if (self->magic == EV_WS_CONN_MAGIC && self->wsi && self->connected) |
|
|
1 |
0 |
if (self->magic == EV_WS_CONN_MAGIC && self->wsi && self->connected) |
|
|
1 |
0 |
if (self->magic == EV_WS_CONN_MAGIC && self->wsi && self->connected) |
|
1855
|
1 |
0 |
if (self->magic == EV_WS_CONN_MAGIC && self->wsi && self->connected) |
|
|
1 |
0 |
if (self->magic == EV_WS_CONN_MAGIC && self->wsi && self->connected) |
|
|
1 |
0 |
if (self->magic == EV_WS_CONN_MAGIC && self->wsi && self->connected) |
|
1863
|
0 |
21 |
if (self->magic != EV_WS_CONN_MAGIC) { |
|
1866
|
20 |
1 |
if (!self->wsi || !self->connected || self->closing) { |
|
|
20 |
0 |
if (!self->wsi || !self->connected || self->closing) { |
|
|
1 |
19 |
if (!self->wsi || !self->connected || self->closing) { |
|
1870
|
0 |
19 |
DEBUG_LOG("Closing connection: code=%d reason=%s", code, reason ? reason : "none"); |
|
|
0 |
0 |
DEBUG_LOG("Closing connection: code=%d reason=%s", code, reason ? reason : "none"); |
|
1871
|
0 |
19 |
if (self->in_fragmented_send) { |
|
1876
|
6 |
13 |
lws_close_reason(self->wsi, (enum lws_close_status)code, |
|
1886
|
6 |
0 |
RETVAL = (self->magic == EV_WS_CONN_MAGIC && self->wsi != NULL && self->connected) ? 1 : 0; |
|
|
3 |
3 |
RETVAL = (self->magic == EV_WS_CONN_MAGIC && self->wsi != NULL && self->connected) ? 1 : 0; |
|
|
2 |
1 |
RETVAL = (self->magic == EV_WS_CONN_MAGIC && self->wsi != NULL && self->connected) ? 1 : 0; |
|
|
2 |
4 |
RETVAL = (self->magic == EV_WS_CONN_MAGIC && self->wsi != NULL && self->connected) ? 1 : 0; |
|
1895
|
3 |
0 |
RETVAL = (self->magic == EV_WS_CONN_MAGIC && self->wsi != NULL && !self->connected && !self->closing) ? 1 : 0; |
|
|
3 |
0 |
RETVAL = (self->magic == EV_WS_CONN_MAGIC && self->wsi != NULL && !self->connected && !self->closing) ? 1 : 0; |
|
|
2 |
1 |
RETVAL = (self->magic == EV_WS_CONN_MAGIC && self->wsi != NULL && !self->connected && !self->closing) ? 1 : 0; |
|
|
2 |
0 |
RETVAL = (self->magic == EV_WS_CONN_MAGIC && self->wsi != NULL && !self->connected && !self->closing) ? 1 : 0; |
|
|
0 |
3 |
RETVAL = (self->magic == EV_WS_CONN_MAGIC && self->wsi != NULL && !self->connected && !self->closing) ? 1 : 0; |
|
1904
|
0 |
8 |
if (self->magic != EV_WS_CONN_MAGIC) RETVAL = "destroyed"; |
|
1905
|
3 |
5 |
else if (!self->wsi) RETVAL = "closed"; |
|
1906
|
0 |
5 |
else if (self->closing) RETVAL = "closing"; |
|
1907
|
2 |
3 |
else if (self->connected) RETVAL = "connected"; |
|
1917
|
0 |
0 |
RETVAL = (self->magic == EV_WS_CONN_MAGIC) ? (UV)self->send_queue_bytes : 0; |
|
|
0 |
0 |
RETVAL = (self->magic == EV_WS_CONN_MAGIC) ? (UV)self->send_queue_bytes : 0; |
|
1930
|
0 |
2 |
CHECK_CONN_OPEN(self); |
|
|
2 |
0 |
CHECK_CONN_OPEN(self); |
|
|
2 |
0 |
CHECK_CONN_OPEN(self); |
|
|
0 |
2 |
CHECK_CONN_OPEN(self); |
|
1934
|
1 |
1 |
if (!self->in_fragmented_send) { |
|
1936
|
1 |
0 |
if (!is_final) { |
|
1942
|
0 |
1 |
if (!is_final) { |
|
1956
|
0 |
2 |
if (self->magic != EV_WS_CONN_MAGIC) |
|
1958
|
1 |
1 |
if (!self->stash) |