summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2020-03-12 11:42:41 +0100
committerStefan Metzmacher <metze@samba.org>2020-03-25 09:04:27 +0000
commit051b7c135c959dad8b19c69aa372c7060e39ff19 (patch)
tree392a9a959e611cfe44e4c6d745cfc5b90274ff9f /lib
parente2d260c7b42e30eca20fc90c8dbb8de82820ee2a (diff)
downloadsamba-051b7c135c959dad8b19c69aa372c7060e39ff19.tar.gz
lib: Simplify writev_cancel()
We can only reasonably cancel a writev request that is still queued. Once writing has started, cancel is pointless. Simplify the if-conditions. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/async_req/async_sock.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/async_req/async_sock.c b/lib/async_req/async_sock.c
index e436d00ac79..e6e5a281a26 100644
--- a/lib/async_req/async_sock.c
+++ b/lib/async_req/async_sock.c
@@ -312,25 +312,17 @@ static bool writev_cancel(struct tevent_req *req)
{
struct writev_state *state = tevent_req_data(req, struct writev_state);
- TALLOC_FREE(state->queue_entry);
- TALLOC_FREE(state->fde);
-
- if (state->count == 0) {
- /*
- * already completed.
- */
- return false;
- }
-
- tevent_req_defer_callback(req, state->ev);
if (state->total_size > 0) {
/*
* We've already started to write :-(
*/
- tevent_req_error(req, EIO);
return false;
}
+ TALLOC_FREE(state->queue_entry);
+ TALLOC_FREE(state->fde);
+
+ tevent_req_defer_callback(req, state->ev);
tevent_req_error(req, ECANCELED);
return true;
}