- Use ng_callout() instead of home-grown implementation.
Submitted by: emax
This commit is contained in:
parent
1e5d735a0a
commit
55acc70931
@ -116,7 +116,6 @@ static ng_disconnect_t ng_h4_disconnect;
|
||||
/* Other stuff */
|
||||
static void ng_h4_timeout (node_p);
|
||||
static void ng_h4_untimeout (node_p);
|
||||
static void ng_h4_queue_timeout (void *);
|
||||
static void ng_h4_process_timeout (node_p, hook_p, void *, int);
|
||||
static int ng_h4_mod_event (module_t, int, void *);
|
||||
|
||||
@ -179,7 +178,7 @@ ng_h4_open(struct cdev *dev, struct tty *tp)
|
||||
sc->got = 0;
|
||||
|
||||
NG_BT_MBUFQ_INIT(&sc->outq, NG_H4_DEFAULTQLEN);
|
||||
callout_handle_init(&sc->timo);
|
||||
ng_callout_init(&sc->timo);
|
||||
|
||||
/* Setup netgraph node */
|
||||
error = ng_make_node_common(&typestruct, &sc->node);
|
||||
@ -959,8 +958,7 @@ ng_h4_timeout(node_p node)
|
||||
{
|
||||
ng_h4_info_p sc = (ng_h4_info_p) NG_NODE_PRIVATE(node);
|
||||
|
||||
NG_NODE_REF(node);
|
||||
sc->timo = timeout(ng_h4_queue_timeout, node, 1);
|
||||
ng_callout(&sc->timo, node, NULL, 1, ng_h4_process_timeout, NULL, 0);
|
||||
sc->flags |= NG_H4_TIMEOUT;
|
||||
} /* ng_h4_timeout */
|
||||
|
||||
@ -974,25 +972,9 @@ ng_h4_untimeout(node_p node)
|
||||
ng_h4_info_p sc = (ng_h4_info_p) NG_NODE_PRIVATE(node);
|
||||
|
||||
sc->flags &= ~NG_H4_TIMEOUT;
|
||||
untimeout(ng_h4_queue_timeout, node, sc->timo);
|
||||
NG_NODE_UNREF(node);
|
||||
ng_uncallout(&sc->timo, node);
|
||||
} /* ng_h4_untimeout */
|
||||
|
||||
/*
|
||||
* OK, timeout has happend, so queue function to process it
|
||||
*/
|
||||
|
||||
static void
|
||||
ng_h4_queue_timeout(void *context)
|
||||
{
|
||||
node_p node = (node_p) context;
|
||||
|
||||
if (NG_NODE_IS_VALID(node))
|
||||
ng_send_fn(node, NULL, &ng_h4_process_timeout, NULL, 0);
|
||||
|
||||
NG_NODE_UNREF(node);
|
||||
} /* ng_h4_queue_timeout */
|
||||
|
||||
/*
|
||||
* Timeout processing function.
|
||||
* We still have data to output to the device, so try sending more.
|
||||
|
@ -94,7 +94,7 @@ typedef struct ng_h4_info {
|
||||
u_int32_t want; /* Number of bytes we want to receive */
|
||||
|
||||
hook_p hook; /* Upstream hook */
|
||||
struct callout_handle timo; /* See man timeout(9) */
|
||||
struct callout timo; /* See man timeout(9) */
|
||||
} ng_h4_info_t;
|
||||
typedef ng_h4_info_t * ng_h4_info_p;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user