diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-11-03 10:09:48 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:05:23 -0500 |
commit | dde07058075d357cfdc63624c8dcaa67ebd40add (patch) | |
tree | c3f29090e37f1bc103a3d6051e708d1ebbe305a5 /source4/smbd | |
parent | 90a8c4acc7e673e6439197776d19cc4b095ac322 (diff) | |
download | samba-dde07058075d357cfdc63624c8dcaa67ebd40add.tar.gz samba-dde07058075d357cfdc63624c8dcaa67ebd40add.tar.bz2 samba-dde07058075d357cfdc63624c8dcaa67ebd40add.zip |
r3507: - added deferred replies on sharing violation in pvfs open. The
deferred reply is short-circuited immediately when the file is
closed by another user, allowing it to be opened by the waiting user.
- added a sane set of timeval manipulation routines
- converted all the events code and code that uses it to use struct
timeval instead of time_t, which allows for microsecond resolution
instead of 1 second resolution. This was needed for doing the pvfs
deferred open code, and is why the patch is so big.
(This used to be commit 0d51511d408d91eb5f68a35e980e0875299b1831)
Diffstat (limited to 'source4/smbd')
-rw-r--r-- | source4/smbd/process_model.h | 6 | ||||
-rw-r--r-- | source4/smbd/process_single.c | 5 | ||||
-rw-r--r-- | source4/smbd/process_standard.c | 2 | ||||
-rw-r--r-- | source4/smbd/service.c | 18 | ||||
-rw-r--r-- | source4/smbd/service.h | 8 |
5 files changed, 22 insertions, 17 deletions
diff --git a/source4/smbd/process_model.h b/source4/smbd/process_model.h index 79373d8a39..92d92a70ad 100644 --- a/source4/smbd/process_model.h +++ b/source4/smbd/process_model.h @@ -40,10 +40,12 @@ struct model_ops { void (*model_startup)(void); /* function to accept new connection */ - void (*accept_connection)(struct event_context *, struct fd_event *, time_t, uint16_t); + void (*accept_connection)(struct event_context *, struct fd_event *, + struct timeval t, uint16_t); /* function to terminate a connection */ - void (*terminate_connection)(struct server_connection *srv_conn, const char *reason); + void (*terminate_connection)(struct server_connection *srv_conn, + const char *reason); /* function to exit server */ void (*exit_server)(struct server_context *srv_ctx, const char *reason); diff --git a/source4/smbd/process_single.c b/source4/smbd/process_single.c index 6ce0479b0c..66074d166d 100644 --- a/source4/smbd/process_single.c +++ b/source4/smbd/process_single.c @@ -38,7 +38,8 @@ static void single_start_server(void) /* called when a listening socket becomes readable */ -static void single_accept_connection(struct event_context *ev, struct fd_event *srv_fde, time_t t, uint16_t flags) +static void single_accept_connection(struct event_context *ev, struct fd_event *srv_fde, + struct timeval t, uint16_t flags) { NTSTATUS status; struct socket_context *sock; @@ -55,7 +56,7 @@ static void single_accept_connection(struct event_context *ev, struct fd_event * conn = server_setup_connection(ev, server_socket, sock, t, socket_get_fd(sock)); if (!conn) { - DEBUG(0,("server_setup_connection(ev, server_socket, sock, t) failed\n")); + DEBUG(0,("server_setup_connection failed\n")); return; } diff --git a/source4/smbd/process_standard.c b/source4/smbd/process_standard.c index 3741ce1b46..c794605dc5 100644 --- a/source4/smbd/process_standard.c +++ b/source4/smbd/process_standard.c @@ -39,7 +39,7 @@ static void standard_model_startup(void) called when a listening socket becomes readable */ static void standard_accept_connection(struct event_context *ev, struct fd_event *srv_fde, - time_t t, uint16_t flags) + struct timeval t, uint16_t flags) { NTSTATUS status; struct socket_context *sock; diff --git a/source4/smbd/service.c b/source4/smbd/service.c index 6d2f9a8149..767d310e2b 100644 --- a/source4/smbd/service.c +++ b/source4/smbd/service.c @@ -205,7 +205,7 @@ static int server_destructor(void *ptr) struct server_connection *server_setup_connection(struct event_context *ev, struct server_socket *server_socket, struct socket_context *sock, - time_t t, + struct timeval t, servid_t server_id) { struct fd_event fde; @@ -226,13 +226,13 @@ struct server_connection *server_setup_connection(struct event_context *ev, fde.handler = server_io_handler; idle.private = srv_conn; - idle.next_event = t + SERVER_DEFAULT_IDLE_TIME; + idle.next_event = timeval_add(&t, SERVER_DEFAULT_IDLE_TIME, 0); idle.handler = server_idle_handler; srv_conn->event.ctx = ev; srv_conn->event.fde = &fde; srv_conn->event.idle = &idle; - srv_conn->event.idle_time = SERVER_DEFAULT_IDLE_TIME; + srv_conn->event.idle_time = timeval_set(SERVER_DEFAULT_IDLE_TIME, 0); srv_conn->server_socket = server_socket; srv_conn->service = server_socket->service; @@ -269,11 +269,12 @@ void server_terminate_connection(struct server_connection *srv_conn, const char srv_conn->service->model_ops->terminate_connection(srv_conn, reason); } -void server_io_handler(struct event_context *ev, struct fd_event *fde, time_t t, uint16_t flags) +void server_io_handler(struct event_context *ev, struct fd_event *fde, + struct timeval t, uint16_t flags) { struct server_connection *conn = fde->private; - conn->event.idle->next_event = t + conn->event.idle_time; + conn->event.idle->next_event = timeval_sum(&t, &conn->event.idle_time); if (flags & EVENT_FD_WRITE) { conn->service->ops->send_handler(conn, t, flags); @@ -286,13 +287,14 @@ void server_io_handler(struct event_context *ev, struct fd_event *fde, time_t t, } -void server_idle_handler(struct event_context *ev, struct timed_event *idle, time_t t) +void server_idle_handler(struct event_context *ev, struct timed_event *idle, + struct timeval t) { struct server_connection *conn = idle->private; - conn->event.idle->next_event = t + conn->event.idle_time; + conn->event.idle->next_event = timeval_sum(&t, &conn->event.idle_time); - conn->service->ops->idle_handler(conn,t); + conn->service->ops->idle_handler(conn, t); } /* return the operations structure for a named backend of the specified type diff --git a/source4/smbd/service.h b/source4/smbd/service.h index 2ac1988f3d..5bb43a74fa 100644 --- a/source4/smbd/service.h +++ b/source4/smbd/service.h @@ -48,13 +48,13 @@ struct server_service_ops { void (*accept_connection)(struct server_connection *); /* function to accept new connection */ - void (*recv_handler)(struct server_connection *, time_t, uint16_t); + void (*recv_handler)(struct server_connection *, struct timeval, uint16_t); /* function to accept new connection */ - void (*send_handler)(struct server_connection *, time_t, uint16_t); + void (*send_handler)(struct server_connection *, struct timeval, uint16_t); /* function to accept new connection */ - void (*idle_handler)(struct server_connection *, time_t); + void (*idle_handler)(struct server_connection *, struct timeval); /* function to close a connection */ void (*close_connection)(struct server_connection *, const char *reason); @@ -114,7 +114,7 @@ struct server_connection { struct event_context *ctx; struct fd_event *fde; struct timed_event *idle; - time_t idle_time; + struct timeval idle_time; } event; servid_t server_id; |