Check-in Number:
|
1228 | |
Date: |
2001-Oct-31 12:45:35 (local)
2001-Oct-31 11:45:35 (UTC) |
User: | rse |
Branch: | |
Comment: |
Improve performance by only flushing the output buffer of we really read from
the socket. If we fulfill the request with data from the user-space buffer we
now no longer force a flush of the output buffer. |
Tickets: |
|
Inspections: |
|
Files: |
|
ossp-pkg/sa/sa.c 1.36 -> 1.37
--- sa.c 2001/10/24 12:11:31 1.36
+++ sa.c 2001/10/31 11:45:35 1.37
@@ -1453,14 +1453,12 @@
if (sa->fdSocket == -1)
return SA_ERR_USE;
- /* trigger a write buffer flush */
- if (sa->nWriteLen > 0)
- sa_flush(sa);
-
/* perform read operation */
rv = SA_OK;
if (sa->nReadSize == 0) {
/* user-space unbuffered I/O */
+ if (sa->nWriteLen > 0)
+ sa_flush(sa);
res = sa_read_raw(sa, cpBuf, nBufReq);
if (res == 0)
rv = SA_ERR_EOF;
@@ -1489,6 +1487,8 @@
res += sa->nReadLen;
sa->nReadLen = 0;
}
+ if (sa->nWriteLen > 0)
+ sa_flush(sa);
if (nBufReq >= sa->nReadSize) {
/* buffer is too small at all, so read directly */
n = sa_read_raw(sa, cpBuf, nBufReq);
|
|