/* Takes care of necessary 'sw' activity, except for receiving packets (which * the caller must do). */ void lswitch_run(struct lswitch *sw) { int i; rconn_run(sw->rconn); if (sw->state == S_CONNECTING) { if (rconn_get_version(sw->rconn) != -1) { lswitch_handshake(sw); sw->state = S_FEATURES_REPLY; } return; } for (i = 0; i < 50; i++) { struct ofpbuf *msg; msg = rconn_recv(sw->rconn); if (!msg) { break; } lswitch_process_packet(sw, msg); ofpbuf_delete(msg); } }
static bool fail_open_local_packet_cb(struct relay *r, void *fail_open_) { struct fail_open_data *fail_open = fail_open_; if (rconn_is_connected(fail_open->remote_rconn) || !fail_open->lswitch) { return false; } else { lswitch_process_packet(fail_open->lswitch, fail_open->local_rconn, r->halves[HALF_LOCAL].rxbuf); rconn_run(fail_open->local_rconn); return true; } }