#include "poll-loop.h"
#include "rconn.h"
#include "shash.h"
+#include "sset.h"
#include "stream-ssl.h"
#include "svec.h"
#include "tag.h"
+#include "timer.h"
#include "timeval.h"
#include "unaligned.h"
#include "unixctl.h"
/* Flow table. */
struct classifier cls;
- long long int next_expiration;
+ struct timer next_expiration;
/* Facets. */
struct hmap facets;
/* Initialize flow table. */
classifier_init(&p->cls);
- p->next_expiration = time_msec() + 1000;
+ timer_set_duration(&p->next_expiration, 1000);
/* Initialize facet table. */
hmap_init(&p->facets);
connmgr_run(p->connmgr, handle_openflow);
- if (time_msec() >= p->next_expiration) {
+ if (timer_expired(&p->next_expiration)) {
int delay = ofproto_expire(p);
- p->next_expiration = time_msec() + delay;
+ timer_set_duration(&p->next_expiration, delay);
COVERAGE_INC(ofproto_expiration);
}
/* Shouldn't happen, but if it does just go around again. */
VLOG_DBG_RL(&rl, "need revalidate in ofproto_wait_cb()");
poll_immediate_wake();
- } else if (p->next_expiration != LLONG_MAX) {
- poll_timer_wait_until(p->next_expiration);
+ } else {
+ timer_wait(&p->next_expiration);
}
connmgr_wait(p->connmgr);
}
reinit_ports(struct ofproto *p)
{
struct dpif_port_dump dump;
- struct shash_node *node;
- struct shash devnames;
+ struct sset devnames;
struct ofport *ofport;
struct dpif_port dpif_port;
+ const char *devname;
COVERAGE_INC(ofproto_reinit_ports);
- shash_init(&devnames);
+ sset_init(&devnames);
HMAP_FOR_EACH (ofport, hmap_node, &p->ports) {
- shash_add_once (&devnames, ofport->opp.name, NULL);
+ sset_add(&devnames, ofport->opp.name);
}
DPIF_PORT_FOR_EACH (&dpif_port, &dump, p->dpif) {
- shash_add_once (&devnames, dpif_port.name, NULL);
+ sset_add(&devnames, dpif_port.name);
}
- SHASH_FOR_EACH (node, &devnames) {
- update_port(p, node->name);
+ SSET_FOR_EACH (devname, &devnames) {
+ update_port(p, devname);
}
- shash_destroy(&devnames);
+ sset_destroy(&devnames);
}
static struct ofport *