From 82c2b79de650665f18d847c1771d28430486225e Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 23 Feb 2011 12:35:32 -0800 Subject: [PATCH] rconn: Clarify rconn_run_wait(). At first glance the vconn_wait() call looks risky because this function checked whether rc->vconn is nonnull at the top. In fact it's OK because rc->state will be S_ACTIVE or S_IDLE only if rc->vconn is nonnull, but there's no harm in putting that check inside the block that only runs if rc->vconn is nonnull. Coverity #10714. --- lib/rconn.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/rconn.c b/lib/rconn.c index 61875764b..443690b84 100644 --- a/lib/rconn.c +++ b/lib/rconn.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010 Nicira Networks. + * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -510,6 +510,9 @@ rconn_run_wait(struct rconn *rc) if (rc->vconn) { vconn_run_wait(rc->vconn); + if ((rc->state & (S_ACTIVE | S_IDLE)) && !list_is_empty(&rc->txq)) { + vconn_wait(rc->vconn, WAIT_SEND); + } } for (i = 0; i < rc->n_monitors; i++) { vconn_run_wait(rc->monitors[i]); @@ -520,10 +523,6 @@ rconn_run_wait(struct rconn *rc) long long int expires = sat_add(rc->state_entered, timeo); poll_timer_wait_until(expires * 1000); } - - if ((rc->state & (S_ACTIVE | S_IDLE)) && !list_is_empty(&rc->txq)) { - vconn_wait(rc->vconn, WAIT_SEND); - } } /* Attempts to receive a packet from 'rc'. If successful, returns the packet; -- 2.43.0