static bool conn_can_read(struct connection *conn)
{
- if (!conn->funcs->can_read(conn))
+ if (conn->is_ignored)
return false;
- if (conn->is_ignored)
+ if (!conn->funcs->can_read(conn))
return false;
/*
static bool conn_can_write(struct connection *conn)
{
- return conn->funcs->can_write(conn) && !conn->is_ignored;
+ return !conn->is_ignored && conn->funcs->can_write(conn);
}
/* This function returns index inside the array if succeed, -1 if fail */
*
* All watches, transactions, buffers will be freed.
*/
-static void ignore_connection(struct connection *conn)
+void ignore_connection(struct connection *conn)
{
struct buffered_data *out, *tmp;
struct connection *new_connection(const struct interface_funcs *funcs);
struct connection *get_connection_by_id(unsigned int conn_id);
+void ignore_connection(struct connection *conn);
void check_store(void);
void corrupt(struct connection *conn, const char *fmt, ...);
domain->shutdown = true;
notify = 1;
}
- /*
- * On Restore, we may have been unable to remap the
- * interface and the port. As we don't know whether
- * this was because of a dying domain, we need to
- * check if the interface and port are still valid.
- */
- if (!dominfo.dying && domain->port &&
- domain->interface)
+ if (!dominfo.dying)
continue;
}
if (domain->conn) {
if (!domain)
barf("domain allocation error");
+ conn = domain->conn;
+
+ /*
+ * We may not have been able to restore the domain (for
+ * instance because it revoked the Xenstore grant). We need
+ * to keep it around to send @releaseDomain when it is
+ * dead. So mark it as ignored.
+ */
+ if (!domain->port || !domain->interface)
+ ignore_connection(conn);
+
if (sc->spec.ring.tdomid != DOMID_INVALID) {
tdomain = find_or_alloc_domain(ctx,
sc->spec.ring.tdomid);
talloc_reference(domain->conn, tdomain->conn);
domain->conn->target = tdomain->conn;
}
- conn = domain->conn;
}
conn->conn_id = sc->conn_id;