|
@@ -4335,6 +4335,9 @@ pull(FILE *fp, struct mg_connection *conn, char *buf, int len, double timeout)
|
|
pfd[0].fd = conn->client.sock;
|
|
pfd[0].fd = conn->client.sock;
|
|
pfd[0].events = POLLIN;
|
|
pfd[0].events = POLLIN;
|
|
pollres = poll(pfd, 1, (int)(timeout * 1000.0));
|
|
pollres = poll(pfd, 1, (int)(timeout * 1000.0));
|
|
|
|
+ if (conn->ctx->stop_flag) {
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
if (pollres > 0) {
|
|
if (pollres > 0) {
|
|
nread = SSL_read(conn->ssl, buf, len);
|
|
nread = SSL_read(conn->ssl, buf, len);
|
|
if (nread <= 0) {
|
|
if (nread <= 0) {
|
|
@@ -4369,6 +4372,9 @@ pull(FILE *fp, struct mg_connection *conn, char *buf, int len, double timeout)
|
|
pfd[0].fd = conn->client.sock;
|
|
pfd[0].fd = conn->client.sock;
|
|
pfd[0].events = POLLIN;
|
|
pfd[0].events = POLLIN;
|
|
pollres = poll(pfd, 1, (int)(timeout * 1000.0));
|
|
pollres = poll(pfd, 1, (int)(timeout * 1000.0));
|
|
|
|
+ if (conn->ctx->stop_flag) {
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
if (pollres > 0) {
|
|
if (pollres > 0) {
|
|
nread = (int)recv(conn->client.sock, buf, (len_t)len, 0);
|
|
nread = (int)recv(conn->client.sock, buf, (len_t)len, 0);
|
|
err = (nread < 0) ? ERRNO : 0;
|
|
err = (nread < 0) ? ERRNO : 0;
|
|
@@ -12224,7 +12230,7 @@ mg_close_connection(struct mg_connection *conn)
|
|
conn->ctx->stop_flag = 1;
|
|
conn->ctx->stop_flag = 1;
|
|
|
|
|
|
/* we need to get the client thread out of the select/recv call here */
|
|
/* we need to get the client thread out of the select/recv call here */
|
|
- mg_websocket_write(conn, WEBSOCKET_OPCODE_CONNECTION_CLOSE, "", 0);
|
|
|
|
|
|
+ // mg_websocket_write(conn, WEBSOCKET_OPCODE_CONNECTION_CLOSE, "", 0);
|
|
|
|
|
|
/* join worker thread */
|
|
/* join worker thread */
|
|
for (i = 0; i < client_ctx->cfg_worker_threads; i++) {
|
|
for (i = 0; i < client_ctx->cfg_worker_threads; i++) {
|