X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Frconn.c;h=6bd43940eebc174bc764a1825656953016ad9586;hb=56cac225ae4df8ff0c50a806b78abdb6ac96c33a;hp=35f42e44259bdf992eb933864555bc6f7b93d63f;hpb=d45e9c65c6c257bb361829607c0f09bb9b14fa41;p=openvswitch diff --git a/lib/rconn.c b/lib/rconn.c index 35f42e44..6bd43940 100644 --- a/lib/rconn.c +++ b/lib/rconn.c @@ -1,5 +1,5 @@ /* - * 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. @@ -176,7 +176,7 @@ rconn_new_from_vconn(const char *name, struct vconn *vconn) 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(); @@ -313,13 +313,13 @@ rconn_destroy(struct rconn *rc) } 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. */ } @@ -459,6 +459,15 @@ void 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) { @@ -476,7 +485,17 @@ rconn_run(struct rconn *rc) 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());