summaryrefslogtreecommitdiffstats
path: root/source4/smbd
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-02-03 02:35:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:09:29 -0500
commit66170ef8b36b499aa5b44ef10c1bd362a50f2636 (patch)
tree5bfb3d759ad397a6a42588b97802e237781c35e8 /source4/smbd
parent1774b36c1464e1f04f982b83577e62fa31cbeef9 (diff)
downloadsamba-66170ef8b36b499aa5b44ef10c1bd362a50f2636.tar.gz
samba-66170ef8b36b499aa5b44ef10c1bd362a50f2636.tar.xz
samba-66170ef8b36b499aa5b44ef10c1bd362a50f2636.zip
r5185: make all the events data structures private to events.c. This will
make it possible to add optimisations to the events code such as keeping the next timed event in a sorted list, and using epoll for file descriptor events. I also removed the loop events code, as it wasn't being used anywhere, and changed timed events to always be one-shot (as adding a new timed event in the event handler is so easy to do if needed) (This used to be commit d7b4b6de51342a65bf46fce772d313f92f8d73d3)
Diffstat (limited to 'source4/smbd')
-rw-r--r--source4/smbd/process_model.c4
-rw-r--r--source4/smbd/process_model.h2
-rw-r--r--source4/smbd/server.c1
-rw-r--r--source4/smbd/service_stream.c30
4 files changed, 12 insertions, 25 deletions
diff --git a/source4/smbd/process_model.c b/source4/smbd/process_model.c
index 16a0075d2d..f4e21e7e14 100644
--- a/source4/smbd/process_model.c
+++ b/source4/smbd/process_model.c
@@ -105,9 +105,7 @@ const struct process_model_critical_sizes *process_model_version(void)
{
static const struct process_model_critical_sizes critical_sizes = {
PROCESS_MODEL_VERSION,
- sizeof(struct model_ops),
- sizeof(struct event_context),
- sizeof(struct fd_event)
+ sizeof(struct model_ops)
};
return &critical_sizes;
diff --git a/source4/smbd/process_model.h b/source4/smbd/process_model.h
index 2e064f4277..137f2add91 100644
--- a/source4/smbd/process_model.h
+++ b/source4/smbd/process_model.h
@@ -58,6 +58,4 @@ struct model_ops {
struct process_model_critical_sizes {
int interface_version;
int sizeof_model_ops;
- int sizeof_event_context;
- int sizeof_fd_event;
};
diff --git a/source4/smbd/server.c b/source4/smbd/server.c
index 57f835970e..bdc7d3212c 100644
--- a/source4/smbd/server.c
+++ b/source4/smbd/server.c
@@ -24,6 +24,7 @@
*/
#include "includes.h"
+#include "events.h"
#include "version.h"
#include "dynconfig.h"
#include "lib/cmdline/popt_common.h"
diff --git a/source4/smbd/service_stream.c b/source4/smbd/service_stream.c
index d832cc233d..60a4c5feca 100644
--- a/source4/smbd/service_stream.c
+++ b/source4/smbd/service_stream.c
@@ -61,9 +61,9 @@ void stream_terminate_connection(struct stream_connection *srv_conn, const char
the select loop has indicated that a stream is ready for IO
*/
static void stream_io_handler(struct event_context *ev, struct fd_event *fde,
- struct timeval t, uint16_t flags)
+ struct timeval t, uint16_t flags, void *private)
{
- struct stream_connection *conn = talloc_get_type(fde->private,
+ struct stream_connection *conn = talloc_get_type(private,
struct stream_connection);
if (flags & EVENT_FD_WRITE) {
conn->ops->send_handler(conn, t, flags);
@@ -85,7 +85,6 @@ static void stream_new_connection(struct event_context *ev,
uint32_t server_id, void *private)
{
struct stream_socket *stream_socket = talloc_get_type(private, struct stream_socket);
- struct fd_event fde;
struct stream_connection *srv_conn;
srv_conn = talloc_zero(ev, struct stream_connection);
@@ -96,19 +95,15 @@ static void stream_new_connection(struct event_context *ev,
talloc_steal(srv_conn, sock);
- fde.private = srv_conn;
- fde.fd = socket_get_fd(sock);
- fde.flags = EVENT_FD_READ;
- fde.handler = stream_io_handler;
-
srv_conn->private = stream_socket->private;
srv_conn->model_ops = stream_socket->model_ops;
srv_conn->event.ctx = ev;
- srv_conn->event.fde = &fde;
srv_conn->socket = sock;
srv_conn->server_id = server_id;
srv_conn->ops = stream_socket->ops;
- srv_conn->event.fde = event_add_fd(ev, &fde, srv_conn);
+ srv_conn->event.fde = event_add_fd(ev, srv_conn, socket_get_fd(sock),
+ EVENT_FD_READ,
+ stream_io_handler, srv_conn);
if (!socket_check_access(sock, "smbd", lp_hostsallow(-1), lp_hostsdeny(-1))) {
stream_terminate_connection(srv_conn, "denied by access rules");
@@ -131,9 +126,9 @@ static void stream_new_connection(struct event_context *ev,
called when someone opens a connection to one of our listening ports
*/
static void stream_accept_handler(struct event_context *ev, struct fd_event *fde,
- struct timeval t, uint16_t flags)
+ struct timeval t, uint16_t flags, void *private)
{
- struct stream_socket *stream_socket = talloc_get_type(fde->private, struct stream_socket);
+ struct stream_socket *stream_socket = talloc_get_type(private, struct stream_socket);
/* ask the process model to create us a process for this new
connection. When done, it calls stream_new_connection()
@@ -158,7 +153,6 @@ NTSTATUS stream_setup_socket(struct event_context *event_context,
{
NTSTATUS status;
struct stream_socket *stream_socket;
- struct fd_event fde;
int i;
stream_socket = talloc_zero(event_context, struct stream_socket);
@@ -198,13 +192,9 @@ NTSTATUS stream_setup_socket(struct event_context *event_context,
return status;
}
- /* we are only interested in read events on the listen socket */
- fde.fd = socket_get_fd(stream_socket->sock);
- fde.flags = EVENT_FD_READ;
- fde.private = stream_socket;
- fde.handler = stream_accept_handler;
-
- event_add_fd(event_context, &fde, stream_socket->sock);
+ event_add_fd(event_context, stream_socket->sock,
+ socket_get_fd(stream_socket->sock),
+ EVENT_FD_READ, stream_accept_handler, stream_socket);
stream_socket->private = talloc_reference(stream_socket, private);
stream_socket->ops = stream_ops;