version 1.17, 2019/02/21 22:08:53 |
version 1.18, 2019/02/21 22:09:47 |
|
|
/* |
/* |
* If we have a request coming down off the wire, pull |
* If we have a request coming down off the wire, pull |
* it in as quickly as possible into our buffer. |
* it in as quickly as possible into our buffer. |
* This unclogs the socket buffers so the data can flow. |
* Start by seeing if we have a log message. |
* FIXME: if we're multiplexing, we might stall here if |
* If we do, pop it off, then see if we have anything |
* there's only a log message and no actual data. |
* left and hit it again if so (read priority). |
* This can be fixed by doing a conditional test. |
|
*/ |
*/ |
|
|
if (pfd[0].revents & POLLIN) |
if (sess->mplex_reads && pfd[0].revents & POLLIN) { |
for (;;) { |
if (!io_read_flush(sess, fdin)) { |
if (!io_read_int(sess, fdin, &idx)) { |
ERRX1(sess, "io_read_flush"); |
ERRX1(sess, "io_read_int"); |
goto out; |
goto out; |
} else if (sess->mplex_read_remain == 0) { |
} |
|
if (!send_dl_enqueue(sess, |
|
&sdlq, idx, fl, flsz, fdin)) { |
|
ERRX1(sess, "send_dl_enqueue"); |
|
goto out; |
|
} |
|
c = io_read_check(sess, fdin); |
c = io_read_check(sess, fdin); |
if (c < 0) { |
if (c < 0) { |
ERRX1(sess, "io_read_check"); |
ERRX1(sess, "io_read_check"); |
goto out; |
goto out; |
} else if (c == 0) |
} else if (c > 0) |
break; |
continue; |
|
pfd[0].revents &= ~POLLIN; |
} |
} |
|
} |
|
|
|
/* |
|
* Now that we've handled the log messages, we're left |
|
* here if we have any actual data coming down. |
|
* Enqueue message requests, then loop again if we see |
|
* more data (read priority). |
|
*/ |
|
|
|
if (pfd[0].revents & POLLIN) { |
|
if (!io_read_int(sess, fdin, &idx)) { |
|
ERRX1(sess, "io_read_int"); |
|
goto out; |
|
} |
|
if (!send_dl_enqueue(sess, |
|
&sdlq, idx, fl, flsz, fdin)) { |
|
ERRX1(sess, "send_dl_enqueue"); |
|
goto out; |
|
} |
|
c = io_read_check(sess, fdin); |
|
if (c < 0) { |
|
ERRX1(sess, "io_read_check"); |
|
goto out; |
|
} else if (c > 0) |
|
continue; |
|
} |
|
|
/* |
/* |
* One of our local files has been opened in response |
* One of our local files has been opened in response |