View | Details | Raw Unified | Return to bug 1286 | Differences between
and this patch

Collapse All | Expand All

(-)old/sftp-server.c (-4 / +13 lines)
Lines 1295-1301 Link Here
1295
		memset(rset, 0, set_size);
1295
		memset(rset, 0, set_size);
1296
		memset(wset, 0, set_size);
1296
		memset(wset, 0, set_size);
1297
1297
1298
		FD_SET(in, rset);
1298
		/* If the oqueue is close to full then we want to wait on just the output.
1299
		 * Also, if the iqueue is almost full we are not interested in more input. */
1300
		if (buffer_check_alloc(&oqueue, SFTP_MAX_MSG_LENGTH + 4) &&
1301
		    buffer_check_alloc(&iqueue, 4*4096))
1302
			FD_SET(in, rset);
1303
1299
		olen = buffer_len(&oqueue);
1304
		olen = buffer_len(&oqueue);
1300
		if (olen > 0)
1305
		if (olen > 0)
1301
			FD_SET(out, wset);
1306
			FD_SET(out, wset);
Lines 1308-1314 Link Here
1308
		}
1313
		}
1309
1314
1310
		/* copy stdin to iqueue */
1315
		/* copy stdin to iqueue */
1311
		if (FD_ISSET(in, rset)) {
1316
		if (buffer_check_alloc(&iqueue, 4*4096) &&
1317
		    FD_ISSET(in, rset)) {
1312
			char buf[4*4096];
1318
			char buf[4*4096];
1313
			len = read(in, buf, sizeof buf);
1319
			len = read(in, buf, sizeof buf);
1314
			if (len == 0) {
1320
			if (len == 0) {
Lines 1331-1337 Link Here
1331
				buffer_consume(&oqueue, len);
1337
				buffer_consume(&oqueue, len);
1332
			}
1338
			}
1333
		}
1339
		}
1334
		/* process requests from client */
1340
		/* process requests from client. If the output buffer
1335
		process();
1341
		 * is critical then don't create more data by
1342
		 * processing more requests. */
1343
		if (buffer_check_alloc(&oqueue, SFTP_MAX_MSG_LENGTH + 4))
1344
			process();
1336
	}
1345
	}
1337
}
1346
}

Return to bug 1286