From 9a77cb247d00828845df02030e7d174351daf432 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 28 Apr 2010 15:05:30 +0200 Subject: s3:rpc_server: add np_read_in_progress() function metze --- source3/include/proto.h | 1 + source3/rpc_server/srv_pipe_hnd.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/source3/include/proto.h b/source3/include/proto.h index 92c757b1ef..116db698e6 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5209,6 +5209,7 @@ NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name, const char *client_address, struct auth_serversupplied_info *server_info, struct fake_file_handle **phandle); +bool np_read_in_progress(struct fake_file_handle *handle); struct tevent_req *np_write_send(TALLOC_CTX *mem_ctx, struct event_context *ev, struct fake_file_handle *handle, const uint8_t *data, size_t len); diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c index 7b8602b0d6..b5b8379efa 100644 --- a/source3/rpc_server/srv_pipe_hnd.c +++ b/source3/rpc_server/srv_pipe_hnd.c @@ -1179,6 +1179,28 @@ NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name, return NT_STATUS_OK; } +bool np_read_in_progress(struct fake_file_handle *handle) +{ + if (handle->type == FAKE_FILE_TYPE_NAMED_PIPE) { + return false; + } + + if (handle->type == FAKE_FILE_TYPE_NAMED_PIPE_PROXY) { + struct np_proxy_state *p = talloc_get_type_abort( + handle->private_data, struct np_proxy_state); + size_t read_count; + + read_count = tevent_queue_length(p->read_queue); + if (read_count > 0) { + return true; + } + + return false; + } + + return false; +} + struct np_write_state { struct event_context *ev; struct np_proxy_state *p; -- cgit