mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-27 12:26:24 +00:00
Added simplistic flow control in transfer_file_data()
This commit is contained in:
1 parent
c7925353e7
commit
7b37e0cb8b
1 file changed
+9
-2
+9
-2
@@ -4494,8 +4494,15 @@ static void close_local_endpoint(struct connection *conn) {
|
||||
|
||||
static void transfer_file_data(struct connection *conn) {
|
||||
char buf[IOBUF_SIZE];
|
||||
int n = read(conn->endpoint.fd, buf, conn->cl < (int64_t) sizeof(buf) ?
|
||||
(int) conn->cl : (int) sizeof(buf));
|
||||
int n;
|
||||
|
||||
// If output buffer is too big, don't send anything. Wait until
|
||||
// mongoose drains already buffered data to the client.
|
||||
if (conn->ns_conn->send_iobuf.len > sizeof(buf) * 2) return;
|
||||
|
||||
// Do not send anyt
|
||||
n = read(conn->endpoint.fd, buf, conn->cl < (int64_t) sizeof(buf) ?
|
||||
(int) conn->cl : (int) sizeof(buf));
|
||||
|
||||
if (n <= 0) {
|
||||
close_local_endpoint(conn);
|
||||
|
||||
Reference in new issue
Block a user