@@ -7237,8 +7237,8 @@ long mg_io_send(struct mg_connection *c, const void *buf, size_t len) {
7237
7237
bool mg_send(struct mg_connection *c, const void *buf, size_t len) {
7238
7238
if (c->is_udp) {
7239
7239
long n = mg_io_send(c, buf, len);
7240
- MG_DEBUG(("%lu %ld %d:%d %ld err %d", c->id, c->fd, (int) c->send.len,
7241
- (int) c->recv.len, n, MG_SOCK_ERR(n)));
7240
+ MG_DEBUG(("%lu %ld %lu:%lu:%lu %ld err %d", c->id, c->fd, c->send.len,
7241
+ c->recv.len, c->rtls .len, n, MG_SOCK_ERR(n)));
7242
7242
iolog(c, (char *) buf, n, false);
7243
7243
return n > 0;
7244
7244
} else {
@@ -7392,9 +7392,8 @@ static void read_conn(struct mg_connection *c) {
7392
7392
} else {
7393
7393
n = recv_raw(c, buf, len);
7394
7394
}
7395
- MG_DEBUG(("%lu %p snd %ld/%ld rcv %ld/%ld n=%ld err=%d", c->id, c->fd,
7396
- (long) c->send.len, (long) c->send.size, (long) c->recv.len,
7397
- (long) c->recv.size, n, MG_SOCK_ERR(n)));
7395
+ MG_DEBUG(("%lu %ld %lu:%lu:%lu %ld err %d", c->id, c->fd, c->send.len,
7396
+ c->recv.len, c->rtls.len, n, MG_SOCK_ERR(n)));
7398
7397
iolog(c, buf, n, true);
7399
7398
}
7400
7399
}
@@ -7582,7 +7581,7 @@ static void mg_iotest(struct mg_mgr *mgr, int ms) {
7582
7581
size_t max = 1;
7583
7582
for (struct mg_connection *c = mgr->conns; c != NULL; c = c->next) {
7584
7583
c->is_readable = c->is_writable = 0;
7585
- if (c->rtls.len > 0) ms = 1, c->is_readable = 1;
7584
+ if (mg_tls_pending(c) > 0) ms = 1, c->is_readable = 1;
7586
7585
if (can_write(c)) MG_EPOLL_MOD(c, 1);
7587
7586
if (c->is_closing) ms = 1;
7588
7587
max++;
@@ -7598,7 +7597,7 @@ static void mg_iotest(struct mg_mgr *mgr, int ms) {
7598
7597
bool wr = evs[i].events & EPOLLOUT;
7599
7598
c->is_readable = can_read(c) && rd ? 1U : 0;
7600
7599
c->is_writable = can_write(c) && wr ? 1U : 0;
7601
- if (c->rtls.len > 0) c->is_readable = 1;
7600
+ if (mg_tls_pending(c) > 0) c->is_readable = 1;
7602
7601
}
7603
7602
}
7604
7603
(void) skip_iotest;
@@ -7612,7 +7611,7 @@ static void mg_iotest(struct mg_mgr *mgr, int ms) {
7612
7611
c->is_readable = c->is_writable = 0;
7613
7612
if (skip_iotest(c)) {
7614
7613
// Socket not valid, ignore
7615
- } else if (c->rtls.len > 0) {
7614
+ } else if (mg_tls_pending(c) > 0) {
7616
7615
ms = 1; // Don't wait if TLS is ready
7617
7616
} else {
7618
7617
fds[n].fd = FD(c);
@@ -7634,7 +7633,7 @@ static void mg_iotest(struct mg_mgr *mgr, int ms) {
7634
7633
for (struct mg_connection *c = mgr->conns; c != NULL; c = c->next) {
7635
7634
if (skip_iotest(c)) {
7636
7635
// Socket not valid, ignore
7637
- } else if (c->rtls.len > 0) {
7636
+ } else if (mg_tls_pending(c) > 0) {
7638
7637
c->is_readable = 1;
7639
7638
} else {
7640
7639
if (fds[n].revents & POLLERR) {
@@ -7643,7 +7642,7 @@ static void mg_iotest(struct mg_mgr *mgr, int ms) {
7643
7642
c->is_readable =
7644
7643
(unsigned) (fds[n].revents & (POLLIN | POLLHUP) ? 1 : 0);
7645
7644
c->is_writable = (unsigned) (fds[n].revents & POLLOUT ? 1 : 0);
7646
- if (c->rtls.len > 0) c->is_readable = 1;
7645
+ if (mg_tls_pending(c) > 0) c->is_readable = 1;
7647
7646
}
7648
7647
n++;
7649
7648
}
@@ -7665,7 +7664,7 @@ static void mg_iotest(struct mg_mgr *mgr, int ms) {
7665
7664
FD_SET(FD(c), &eset);
7666
7665
if (can_read(c)) FD_SET(FD(c), &rset);
7667
7666
if (can_write(c)) FD_SET(FD(c), &wset);
7668
- if (c->rtls.len > 0) tvp = &tv_zero;
7667
+ if (mg_tls_pending(c) > 0) tvp = &tv_zero;
7669
7668
if (FD(c) > maxfd) maxfd = FD(c);
7670
7669
if (c->is_closing) ms = 1;
7671
7670
}
@@ -7687,7 +7686,7 @@ static void mg_iotest(struct mg_mgr *mgr, int ms) {
7687
7686
} else {
7688
7687
c->is_readable = FD(c) != MG_INVALID_SOCKET && FD_ISSET(FD(c), &rset);
7689
7688
c->is_writable = FD(c) != MG_INVALID_SOCKET && FD_ISSET(FD(c), &wset);
7690
- if (c->rtls.len > 0) c->is_readable = 1;
7689
+ if (mg_tls_pending(c) > 0) c->is_readable = 1;
7691
7690
}
7692
7691
}
7693
7692
#endif
0 commit comments