diff options
author | Ralph Boehme <slow@samba.org> | 2017-01-10 14:22:21 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2017-04-18 22:54:16 +0200 |
commit | 27acbb26ee7ae8d4f475ed742fb28ada84f24cc1 (patch) | |
tree | 37a7c98bbdef799c0622c9be2ffcf75b475bbe91 /lib/dbwrap | |
parent | 1fcb66efe0530593cc31a3f64a96fc5ca543fcc3 (diff) | |
download | samba-27acbb26ee7ae8d4f475ed742fb28ada84f24cc1.tar.gz |
dbwrap: add enum dbwrap_req_state
This will be used by async dwrap_parse_send() as an out argument, giving
the caller an indication about the state of the request.
This is can be useful for the caller if it is a sync function and sends
multiple async dbwrap requests. As it's a sync function it won't return
to the main tevent event loop and so the async dbwrap recv function are
not called.
As a result the function may deadlock: our receive queue may already be
full with results from a peer, the peer might be blocked in his send
queue (because we're not receiving), the peer therefor doesn't read from
his receive queue so our send queue will block as well.
To inform the caller of this situation "send queue full" we return this
state information to the caller of the dbwrap send function.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'lib/dbwrap')
-rw-r--r-- | lib/dbwrap/dbwrap.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/dbwrap/dbwrap.h b/lib/dbwrap/dbwrap.h index 6b77236c530..936e66247d7 100644 --- a/lib/dbwrap/dbwrap.h +++ b/lib/dbwrap/dbwrap.h @@ -43,6 +43,29 @@ enum dbwrap_lock_order { #define DBWRAP_FLAG_NONE 0x0000000000000000ULL #define DBWRAP_FLAG_OPTIMIZE_READONLY_ACCESS 0x0000000000000001ULL +enum dbwrap_req_state { + /** + * We are creating the request + */ + DBWRAP_REQ_INIT, + /** + * The request is queued and waiting to be dispatched + */ + DBWRAP_REQ_QUEUED, + /** + * We are waiting to receive the reply + */ + DBWRAP_REQ_DISPATCHED, + /** + * The request is finished + */ + DBWRAP_REQ_DONE, + /** + * The request errored out + */ + DBWRAP_REQ_ERROR +}; + /* The following definitions come from lib/dbwrap.c */ TDB_DATA dbwrap_record_get_key(const struct db_record *rec); |