diff options
author | bubulle <bubulle@alioth.debian.org> | 2012-12-12 21:11:47 +0000 |
---|---|---|
committer | bubulle <bubulle@alioth.debian.org> | 2012-12-12 21:11:47 +0000 |
commit | 63f07bb10f08040c39530bdc6aaea46c7c0ac9dd (patch) | |
tree | 72e23ab4ded614b11b21fb13aea9f8eb58727a65 /lib/tsocket/tsocket_helpers.c | |
parent | 2cf876031f5616a1de04777c978d7847887b45ac (diff) | |
download | samba-63f07bb10f08040c39530bdc6aaea46c7c0ac9dd.tar.gz |
Load samba-3.6.10 into branches/samba/upstream.upstream/3.6.10
git-svn-id: svn://svn.debian.org/svn/pkg-samba/branches/samba/upstream@4179 fc4039ab-9d04-0410-8cac-899223bdd6b0
Diffstat (limited to 'lib/tsocket/tsocket_helpers.c')
-rw-r--r-- | lib/tsocket/tsocket_helpers.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/tsocket/tsocket_helpers.c b/lib/tsocket/tsocket_helpers.c index 3a41a3efc3..809830d79a 100644 --- a/lib/tsocket/tsocket_helpers.c +++ b/lib/tsocket/tsocket_helpers.c @@ -212,6 +212,20 @@ static void tstream_readv_pdu_ask_for_next_vector(struct tevent_req *req) size_t to_read = 0; size_t i; struct tevent_req *subreq; + bool optimize = false; + bool save_optimize = false; + + if (state->count > 0) { + /* + * This is not the first time we asked for a vector, + * which means parts of the pdu already arrived. + * + * In this case it make sense to enable + * a syscall/performance optimization if the + * low level tstream implementation supports it. + */ + optimize = true; + } TALLOC_FREE(state->vector); state->count = 0; @@ -255,11 +269,26 @@ static void tstream_readv_pdu_ask_for_next_vector(struct tevent_req *req) return; } + if (optimize) { + /* + * If the low level stream is a bsd socket + * we will get syscall optimization. + * + * If it is not a bsd socket + * tstream_bsd_optimize_readv() just returns. + */ + save_optimize = tstream_bsd_optimize_readv(state->caller.stream, + true); + } subreq = tstream_readv_send(state, state->caller.ev, state->caller.stream, state->vector, state->count); + if (optimize) { + tstream_bsd_optimize_readv(state->caller.stream, + save_optimize); + } if (tevent_req_nomem(subreq, req)) { return; } |