/* event handler types */
typedef void (*event_fd_handler_t)(struct event_context *, struct fd_event *,
- struct timeval , uint16_t , void *);
+ uint16_t , void *);
typedef void (*event_timed_handler_t)(struct event_context *, struct timed_event *,
struct timeval , void *);
/*
called when a LDAP socket becomes readable
*/
-static void ldapsrv_recv(struct stream_connection *conn, struct timeval t,
- uint16_t flags)
+static void ldapsrv_recv(struct stream_connection *conn, uint16_t flags)
{
struct ldapsrv_connection *ldap_conn = talloc_get_type(conn->private, struct ldapsrv_connection);
uint8_t *buf;
/*
called when a LDAP socket becomes writable
*/
-static void ldapsrv_send(struct stream_connection *conn, struct timeval t,
- uint16_t flags)
+static void ldapsrv_send(struct stream_connection *conn, uint16_t flags)
{
struct ldapsrv_connection *ldap_conn = talloc_get_type(conn->private, struct ldapsrv_connection);
struct epoll_event events[maxevents];
uint32_t destruction_count = ev->destruction_count;
int timeout = -1;
- struct timeval t;
if (tvalp) {
timeout = (tvalp->tv_usec / 1000) + (tvalp->tv_sec*1000);
ret = epoll_wait(ev->epoll_fd, events, maxevents, timeout);
- if (ret == -1) {
+ if (ret == -1 && errno != EINTR) {
epoll_fallback_to_select(ev, "epoll_wait() failed");
return -1;
}
return 0;
}
- t = timeval_current();
-
for (i=0;i<ret;i++) {
struct fd_event *fde = talloc_get_type(events[i].data.ptr,
struct fd_event);
if (events[i].events & EPOLLIN) flags |= EVENT_FD_READ;
if (events[i].events & EPOLLOUT) flags |= EVENT_FD_WRITE;
if (flags) {
- fde->handler(ev, fde, t, flags, fde->private);
+ fde->handler(ev, fde, flags, fde->private);
if (destruction_count != ev->destruction_count) {
break;
}
}
if (selrtn > 0) {
- struct timeval t = timeval_current();
/* at least one file descriptor is ready - check
which ones and call the handler, being careful to allow
the handler to remove itself when called */
if (FD_ISSET(fe->fd, &r_fds)) flags |= EVENT_FD_READ;
if (FD_ISSET(fe->fd, &w_fds)) flags |= EVENT_FD_WRITE;
if (flags) {
- fe->handler(ev, fe, t, flags, fe->private);
+ fe->handler(ev, fe, flags, fe->private);
if (destruction_count != ev->destruction_count) {
break;
}
}
/*
- do a single event loop using the events defined in ev this function
+ do a single event loop using the events defined in ev
*/
int event_loop_once(struct event_context *ev)
{
handle IO for a single message
*/
static void messaging_recv_handler(struct event_context *ev, struct fd_event *fde,
- struct timeval t, uint16_t flags, void *private)
+ uint16_t flags, void *private)
{
struct messaging_rec *rec = talloc_get_type(private, struct messaging_rec);
struct messaging_context *msg = rec->msg;
handle a new incoming connection
*/
static void messaging_listen_handler(struct event_context *ev, struct fd_event *fde,
- struct timeval t, uint16_t flags, void *private)
+ uint16_t flags, void *private)
{
struct messaging_context *msg = talloc_get_type(private,
struct messaging_context);
handle IO for sending a message
*/
static void messaging_send_handler(struct event_context *ev, struct fd_event *fde,
- struct timeval t, uint16_t flags, void *private)
+ uint16_t flags, void *private)
{
struct messaging_rec *rec = talloc_get_type(private, struct messaging_rec);
NTSTATUS status;
handle fd events on a nbt_name_socket
*/
static void nbt_name_socket_handler(struct event_context *ev, struct fd_event *fde,
- struct timeval t, uint16_t flags, void *private)
+ uint16_t flags, void *private)
{
struct nbt_name_socket *nbtsock = talloc_get_type(private,
struct nbt_name_socket);
has either completed the connect() or has returned an error
*/
static void smbcli_sock_connect_handler(struct event_context *ev, struct fd_event *fde,
- struct timeval t, uint16_t flags, void *private)
+ uint16_t flags, void *private)
{
struct composite_context *c = talloc_get_type(private, struct composite_context);
struct clisocket_connect *conn = talloc_get_type(c->private, struct clisocket_connect);
*/
static void smbcli_transport_event_handler(struct event_context *ev,
struct fd_event *fde,
- struct timeval t,
uint16_t flags, void *private)
{
struct smbcli_transport *transport = talloc_get_type(private,
handle a read event on the pipe
*/
static void pipe_handler(struct event_context *ev, struct fd_event *fde,
- struct timeval t, uint16_t flags, void *private)
+ uint16_t flags, void *private)
{
struct composite_context *c = talloc_get_type(private, struct composite_context);
struct host_state *state = talloc_get_type(c->private, struct host_state);
/* we need to put the child in our event context so
we know when the gethostbyname() has finished */
- state->fde = event_add_fd(c->event_ctx, state, state->child_fd, EVENT_FD_READ,
+ state->fde = event_add_fd(c->event_ctx, c, state->child_fd, EVENT_FD_READ,
pipe_handler, c);
if (state->fde == NULL) {
close(fd[0]);
called when a IO is triggered by the events system
*/
static void sock_io_handler(struct event_context *ev, struct fd_event *fde,
- struct timeval t, uint16_t flags, void *private)
+ uint16_t flags, void *private)
{
struct dcerpc_connection *p = talloc_get_type(private, struct dcerpc_connection);
struct sock_private *sock = p->transport.private;
a handler for read events on a connection to a backend server
*/
static void cifs_socket_handler(struct event_context *ev, struct fd_event *fde,
- struct timeval t, uint16_t flags, void *private)
+ uint16_t flags, void *private)
{
struct cvfs_private *cvfs = talloc_get_type(private, struct cvfs_private);
struct smbsrv_tcon *tcon = cvfs->tcon;
return;
}
-void dcesrv_sock_recv(struct stream_connection *conn, struct timeval t, uint16_t flags)
+void dcesrv_sock_recv(struct stream_connection *conn, uint16_t flags)
{
NTSTATUS status;
struct dcesrv_connection *dce_conn = talloc_get_type(conn->private, struct dcesrv_connection);
}
}
-void dcesrv_sock_send(struct stream_connection *conn, struct timeval t, uint16_t flags)
+void dcesrv_sock_send(struct stream_connection *conn, uint16_t flags)
{
struct dcesrv_connection *dce_conn = talloc_get_type(conn->private, struct dcesrv_connection);
NTSTATUS status;
receive a SMB request header from the wire, forming a request_context
from the result
****************************************************************************/
-static NTSTATUS receive_smb_request(struct smbsrv_connection *smb_conn, struct timeval t)
+static NTSTATUS receive_smb_request(struct smbsrv_connection *smb_conn)
{
NTSTATUS status;
ssize_t len;
}
/* we have a full packet */
- req->request_time = t;
+ req->request_time = timeval_current();
req->chained_fnum = -1;
req->in.allocated = req->in.size;
req->in.hdr = req->in.buffer + NBT_HDR_SIZE;
/*
called when a SMB socket becomes readable
*/
-static void smbsrv_recv(struct stream_connection *conn, struct timeval t, uint16_t flags)
+static void smbsrv_recv(struct stream_connection *conn, uint16_t flags)
{
struct smbsrv_connection *smb_conn = talloc_get_type(conn->private, struct smbsrv_connection);
NTSTATUS status;
DEBUG(10,("smbsrv_recv\n"));
- status = receive_smb_request(smb_conn, t);
+ status = receive_smb_request(smb_conn);
if (NT_STATUS_IS_ERR(status)) {
talloc_free(conn->event.fde);
conn->event.fde = NULL;
/*
called when a SMB socket becomes writable
*/
-static void smbsrv_send(struct stream_connection *conn, struct timeval t, uint16_t flags)
+static void smbsrv_send(struct stream_connection *conn, uint16_t flags)
{
struct smbsrv_connection *smb_conn = talloc_get_type(conn->private, struct smbsrv_connection);
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, void *private)
+ uint16_t flags, void *private)
{
struct stream_connection *conn = talloc_get_type(private,
struct stream_connection);
if (flags & EVENT_FD_WRITE) {
- conn->ops->send_handler(conn, t, flags);
+ conn->ops->send_handler(conn, flags);
return;
}
if (flags & EVENT_FD_READ) {
- conn->ops->recv_handler(conn, t, flags);
+ conn->ops->recv_handler(conn, flags);
}
}
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, void *private)
+ uint16_t flags, void *private)
{
struct stream_socket *stream_socket = talloc_get_type(private, struct stream_socket);
/* the name of the server_service */
const char *name;
void (*accept_connection)(struct stream_connection *);
- void (*recv_handler)(struct stream_connection *, struct timeval, uint16_t);
- void (*send_handler)(struct stream_connection *, struct timeval, uint16_t);
+ void (*recv_handler)(struct stream_connection *, uint16_t);
+ void (*send_handler)(struct stream_connection *, uint16_t);
};
req->async.fn = increment_handler;
req->async.private = result;
num_sent++;
- if (num_sent % 100 == 0) {
+ if (num_sent % 1000 == 0) {
printf("%.1f queries per second (%d failures) \r",
result->num_pass / timeval_elapsed(&tv),
result->num_fail);
/*
receive some data on a winbind connection
*/
-static void winbind_recv(struct stream_connection *conn, struct timeval t, uint16_t flags)
+static void winbind_recv(struct stream_connection *conn, uint16_t flags)
{
struct wbserver_connection *wbconn = talloc_get_type(conn->private, struct wbserver_connection);
NTSTATUS status;
/*
called when we can write to a connection
*/
-static void winbind_send(struct stream_connection *conn, struct timeval t, uint16_t flags)
+static void winbind_send(struct stream_connection *conn, uint16_t flags)
{
struct wbserver_connection *wbconn = talloc_get_type(conn->private, struct wbserver_connection);