/*
- * Copyright (c) 2008, 2009 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
struct rconn *
rconn_create(int probe_interval, int max_backoff)
{
- struct rconn *rc = xcalloc(1, sizeof *rc);
+ struct rconn *rc = xzalloc(sizeof *rc);
rc->state = S_VOID;
rc->state_entered = time_now();
}
static unsigned int
-timeout_VOID(const struct rconn *rc UNUSED)
+timeout_VOID(const struct rconn *rc OVS_UNUSED)
{
return UINT_MAX;
}
static void
-run_VOID(struct rconn *rc UNUSED)
+run_VOID(struct rconn *rc OVS_UNUSED)
{
/* Nothing to do. */
}
rconn_run(struct rconn *rc)
{
int old_state;
+ size_t i;
+
+ if (rc->vconn) {
+ vconn_run(rc->vconn);
+ }
+ for (i = 0; i < rc->n_monitors; i++) {
+ vconn_run(rc->monitors[i]);
+ }
+
do {
old_state = rc->state;
switch (rc->state) {
void
rconn_run_wait(struct rconn *rc)
{
- unsigned int timeo = timeout(rc);
+ unsigned int timeo;
+ size_t i;
+
+ if (rc->vconn) {
+ vconn_run_wait(rc->vconn);
+ }
+ for (i = 0; i < rc->n_monitors; i++) {
+ vconn_run_wait(rc->monitors[i]);
+ }
+
+ timeo = timeout(rc);
if (timeo != UINT_MAX) {
unsigned int expires = sat_add(rc->state_entered, timeo);
unsigned int remaining = sat_sub(expires, time_now());
if (rconn_is_connected(rc)) {
COVERAGE_INC(rconn_queued);
copy_to_monitor(rc, b);
- b->private = counter;
+ b->private_p = counter;
if (counter) {
rconn_packet_counter_inc(counter);
}
{
int retval = 0;
struct ofpbuf *next = rc->txq.head->next;
- struct rconn_packet_counter *counter = rc->txq.head->private;
+ struct rconn_packet_counter *counter = rc->txq.head->private_p;
retval = vconn_send(rc->vconn, rc->txq.head);
if (retval) {
if (retval != EAGAIN) {
}
while (rc->txq.n > 0) {
struct ofpbuf *b = queue_pop_head(&rc->txq);
- struct rconn_packet_counter *counter = b->private;
+ struct rconn_packet_counter *counter = b->private_p;
if (counter) {
rconn_packet_counter_dec(counter);
}