static void ofconn_destroy(struct ofconn *);
static void ofconn_run(struct ofconn *, struct ofproto *);
static void ofconn_wait(struct ofconn *);
+static bool ofconn_receives_async_msgs(const struct ofconn *);
+
static void queue_tx(struct ofpbuf *msg, const struct ofconn *ofconn,
struct rconn_packet_counter *counter);
struct ofp_port_status *ops;
struct ofpbuf *b;
- if (ofconn->role == NX_ROLE_SLAVE) {
+ if (!ofconn_receives_async_msgs(ofconn)) {
continue;
}
COVERAGE_INC(ofproto_ofconn_stuck);
}
}
+
+/* Returns true if 'ofconn' should receive asynchronous messages. */
+static bool
+ofconn_receives_async_msgs(const struct ofconn *ofconn)
+{
+ if (ofconn->type == OFCONN_CONTROLLER) {
+ /* Ordinary controllers always get asynchronous messages unless they
+ * have configured themselves as "slaves". */
+ return ofconn->role != NX_ROLE_SLAVE;
+ } else {
+ /* Transient connections don't get asynchronous messages unless they
+ * have explicitly asked for them by setting a nonzero miss send
+ * length. */
+ return ofconn->miss_send_len > 0;
+ }
+}
\f
/* Caller is responsible for initializing the 'cr' member of the returned
* rule. */
prev = NULL;
LIST_FOR_EACH (ofconn, struct ofconn, node, &p->all_conns) {
if (rule->send_flow_removed && rconn_is_connected(ofconn->rconn)
- && ofconn->role != NX_ROLE_SLAVE) {
+ && ofconn_receives_async_msgs(ofconn)) {
if (prev) {
queue_tx(ofpbuf_clone(buf), prev, prev->reply_counter);
} else {
prev = NULL;
LIST_FOR_EACH (ofconn, struct ofconn, node, &ofproto->all_conns) {
- if (ofconn->role != NX_ROLE_SLAVE) {
+ if (ofconn_receives_async_msgs(ofconn)) {
if (prev) {
schedule_packet_in(prev, packet, max_len, true);
}