summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/libsmb/cli_np_tstream.c15
-rw-r--r--source3/libsmb/cli_np_tstream.h3
2 files changed, 18 insertions, 0 deletions
diff --git a/source3/libsmb/cli_np_tstream.c b/source3/libsmb/cli_np_tstream.c
index a46b511905..1cab1ed460 100644
--- a/source3/libsmb/cli_np_tstream.c
+++ b/source3/libsmb/cli_np_tstream.c
@@ -35,6 +35,7 @@ struct tstream_cli_np {
struct cli_state *cli;
const char *npipe;
uint16_t fnum;
+ unsigned int default_timeout;
struct {
bool active;
@@ -176,6 +177,7 @@ NTSTATUS _tstream_cli_np_open_recv(struct tevent_req *req,
cli_nps->cli = state->cli;
cli_nps->npipe = talloc_move(cli_nps, &state->npipe);
cli_nps->fnum = state->fnum;
+ cli_nps->default_timeout = state->cli->timeout;
talloc_set_destructor(cli_nps, tstream_cli_np_destructor);
@@ -233,6 +235,19 @@ NTSTATUS tstream_cli_np_use_trans(struct tstream_context *stream)
return NT_STATUS_OK;
}
+unsigned int tstream_cli_np_set_timeout(struct tstream_context *stream,
+ unsigned int timeout)
+{
+ struct tstream_cli_np *cli_nps = tstream_context_data(stream,
+ struct tstream_cli_np);
+
+ if (!cli_state_is_connected(cli_nps->cli)) {
+ return cli_nps->default_timeout;
+ }
+
+ return cli_set_timeout(cli_nps->cli, timeout);
+}
+
struct tstream_cli_np_writev_state {
struct tstream_context *stream;
struct tevent_context *ev;
diff --git a/source3/libsmb/cli_np_tstream.h b/source3/libsmb/cli_np_tstream.h
index 647a4abb37..01dab085e0 100644
--- a/source3/libsmb/cli_np_tstream.h
+++ b/source3/libsmb/cli_np_tstream.h
@@ -48,4 +48,7 @@ bool tstream_is_cli_np(struct tstream_context *stream);
NTSTATUS tstream_cli_np_use_trans(struct tstream_context *stream);
+unsigned int tstream_cli_np_set_timeout(struct tstream_context *stream,
+ unsigned int timeout);
+
#endif /* _CLI_NP_TSTREAM_H_ */