1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3:rpc_client: let rpc_transport_tstream_init() create read and write queue

metze
This commit is contained in:
Stefan Metzmacher 2010-06-22 18:01:45 -04:00
parent 07ba35adcb
commit e55426fe79
3 changed files with 17 additions and 28 deletions

View File

@ -4244,10 +4244,8 @@ NTSTATUS rpc_transport_sock_init(TALLOC_CTX *mem_ctx, int fd,
/* The following definitions come from rpc_client/rpc_transport_tstream.c */
NTSTATUS rpc_transport_tstream_init(TALLOC_CTX *mem_ctx,
struct tstream_context *npipe,
struct tevent_queue *read_queue,
struct tevent_queue *write_queue,
struct rpc_cli_transport **presult);
struct tstream_context **stream,
struct rpc_cli_transport **presult);
/* The following definitions come from rpc_server/srv_eventlog_nt.c */

View File

@ -316,17 +316,13 @@ static NTSTATUS rpc_tstream_write_recv(struct tevent_req *req, ssize_t *sent)
*
* @param mem_ctx - memory context used to allocate the transport
* @param stream - a ready to use tstream
* @param read_queue - pre-createted tstream read queue
* @param write_queue - pre-createted tstream write queue
* @param presult - the transport structure
*
* @return - a NT Status error code.
*/
NTSTATUS rpc_transport_tstream_init(TALLOC_CTX *mem_ctx,
struct tstream_context *stream,
struct tevent_queue *read_queue,
struct tevent_queue *write_queue,
struct rpc_cli_transport **presult)
struct tstream_context **stream,
struct rpc_cli_transport **presult)
{
struct rpc_cli_transport *result;
struct rpc_tstream_state *state;
@ -342,9 +338,18 @@ NTSTATUS rpc_transport_tstream_init(TALLOC_CTX *mem_ctx,
}
result->priv = state;
state->stream = talloc_steal(state, stream);
state->read_queue = talloc_steal(state, read_queue);
state->write_queue = talloc_steal(state, write_queue);
state->read_queue = tevent_queue_create(state, "read_queue");
if (state->read_queue == NULL) {
TALLOC_FREE(result);
return NT_STATUS_NO_MEMORY;
}
state->write_queue = tevent_queue_create(state, "write_queue");
if (state->write_queue == NULL) {
TALLOC_FREE(result);
return NT_STATUS_NO_MEMORY;
}
state->stream = talloc_move(state, stream);
state->timeout = 10000; /* 10 seconds. */
result->trans_send = NULL;

View File

@ -606,18 +606,6 @@ struct np_proxy_state *make_external_rpc_pipe_p(TALLOC_CTX *mem_ctx,
return NULL;
}
result->read_queue = tevent_queue_create(result, "np_read");
if (result->read_queue == NULL) {
DEBUG(0, ("tevent_queue_create failed\n"));
goto fail;
}
result->write_queue = tevent_queue_create(result, "np_write");
if (result->write_queue == NULL) {
DEBUG(0, ("tevent_queue_create failed\n"));
goto fail;
}
ev = s3_tevent_context_init(talloc_tos());
if (ev == NULL) {
DEBUG(0, ("s3_tevent_context_init failed\n"));
@ -756,9 +744,7 @@ static NTSTATUS rpc_pipe_open_external(TALLOC_CTX *mem_ctx,
result->max_recv_frag = RPC_MAX_PDU_FRAG_LEN;
status = rpc_transport_tstream_init(result,
proxy_state->npipe,
proxy_state->read_queue,
proxy_state->write_queue,
&proxy_state->npipe,
&result->transport);
if (!NT_STATUS_IS_OK(status)) {
goto done;