Commit 05c67064 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(write_err_cb): Adjusted to the new API of ISC callback functions.

(stale_cb): Ditto.
(idle_cb): Ditto.
(login_request): Ditto.
(data_available_callback): Ditto.
(handle_accept_event): Ditto.
parent 089163e3
/*
* $Id: connections.c,v 0.113 2003/08/02 20:45:09 ceder Exp $
* $Id: connections.c,v 0.114 2003/08/04 06:54:26 ceder Exp $
* Copyright (C) 1991-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -127,6 +127,9 @@ BUGDECL;
static oop_call_fd data_available_callback;
static oop_call_time check_kill_flg;
static oop_call_time check_idle_callback;
static isc_write_error_cb write_err_cb;
static isc_stale_output_cb stale_cb;
static isc_stale_output_cb idle_cb;
static Connection *queue_first = NULL;
static Connection *queue_last = NULL;
......@@ -711,12 +714,10 @@ get_host_name(union isc_address *addr)
}
static void
write_err_cb(struct isc_mcb *UNUSED(cb_mcb),
struct isc_scb *UNUSED(cb_session),
int saved_errno,
void *user)
write_err_cb(struct isc_scb *cb_session,
int saved_errno)
{
Connection * cp = user;
Connection * cp = cb_session->udg;
if (saved_errno != ECONNRESET && saved_errno != EPIPE)
kom_log("Failed to write to client %lu from %s: %s\n",
cp->session_no, cp->peer, strerror(saved_errno));
......@@ -726,11 +727,9 @@ write_err_cb(struct isc_mcb *UNUSED(cb_mcb),
static void
stale_cb(struct isc_mcb *UNUSED(cb_mcb),
struct isc_scb *UNUSED(cb_session),
void *user)
stale_cb(struct isc_scb *cb_session)
{
Connection *cp = user;
Connection *cp = cb_session->udg;
kom_log("Client %lu from %s has stalled. Killing it.\n",
cp->session_no, cp->peer);
cp->penalty += param.max_penalty;
......@@ -739,11 +738,9 @@ stale_cb(struct isc_mcb *UNUSED(cb_mcb),
static void
idle_cb(struct isc_mcb *UNUSED(cb_mcb),
struct isc_scb *UNUSED(cb_session),
void *user)
idle_cb(struct isc_scb *cb_session)
{
Connection *cp = user;
Connection *cp = cb_session->udg;
kom_log("Client %lu from %s has been idle too long. Killing it.\n",
cp->session_no, cp->peer);
cp->penalty += param.max_penalty;
......@@ -829,7 +826,7 @@ login_request(struct isc_scb *session)
dump_connections();
isc_set_read_callback(session, data_available_callback, write_err_cb,
stale_cb, idle_cb, cp);
stale_cb, idle_cb);
}
static void
......@@ -1014,7 +1011,7 @@ data_available_callback(oop_source *source,
oop_event event,
void *user)
{
Connection *conn = user;
Connection *conn = ((struct isc_scb*)user)->udg;
assert(event == OOP_READ);
assert(conn->isc_session->fd == fd);
......@@ -1039,18 +1036,17 @@ data_available_callback(oop_source *source,
void *
handle_accept_event(struct isc_mcb *mcb,
struct isc_scb *UNUSED(accepting_session),
handle_accept_event(struct isc_scb *UNUSED(accepting_session),
struct isc_scb *new_session)
{
assert(mcb == kom_server_mcb);
new_session->udg = NULL;
if (new_session->fd <= PROTECTED_FDS || new_session->fd >= fd_ceiling)
{
BUG(("Connection attempt rejected.\n"));
isc_puts("%% No connections left.\n", new_session);
isc_flush(new_session);
isc_destroy(mcb, new_session);
isc_destroy(new_session->master, new_session);
async_rejected_connection();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment