summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-12-14 18:17:45 +0100
committerStefan Metzmacher <metze@samba.org>2010-12-15 15:26:05 +0100
commitc0f9e963b66fa8c97a4c0ea38367443dd6127509 (patch)
treec0858719da3d4b8ed5542a8ed31ab7066f51c0d1
parent0df669e14111de741ded8445a2acc00a51a50413 (diff)
downloadsamba-c0f9e963b66fa8c97a4c0ea38367443dd6127509.tar.gz
samba-c0f9e963b66fa8c97a4c0ea38367443dd6127509.tar.bz2
samba-c0f9e963b66fa8c97a4c0ea38367443dd6127509.zip
s3:libsmb: add tstream_cli_np_set_timeout()
metze
-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_ */