From: Ben Pfaff Date: Wed, 9 Dec 2009 01:14:36 +0000 (-0800) Subject: ovsdb-idl: Bug fixes. X-Git-Tag: v1.0.0~259^2~438 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;ds=sidebyside;h=72c6edc5d546a7cda621ceecdb9b851bb8707b10;p=sliver-openvswitch.git ovsdb-idl: Bug fixes. --- diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index 22e20db02..511ae9130 100644 --- a/lib/ovsdb-idl.c +++ b/lib/ovsdb-idl.c @@ -599,7 +599,7 @@ ovsdb_idl_row_reparse_backrefs(struct ovsdb_idl_row *row, bool destroy_dsts) static struct ovsdb_idl_row * ovsdb_idl_row_create__(const struct ovsdb_idl_table_class *class) { - struct ovsdb_idl_row *row = xmalloc(class->allocation_size); + struct ovsdb_idl_row *row = xzalloc(class->allocation_size); memset(row, 0, sizeof *row); list_init(&row->src_arcs); list_init(&row->dst_arcs); @@ -916,7 +916,6 @@ ovsdb_idl_txn_commit(struct ovsdb_idl_txn *txn) struct ovsdb_idl_row *row; struct json *operations; bool any_updates; - enum ovsdb_idl_txn_status status; if (txn != txn->idl->txn) { return txn->status; @@ -1018,22 +1017,20 @@ ovsdb_idl_txn_commit(struct ovsdb_idl_txn *txn) } } - status = (!any_updates ? TXN_SUCCESS - : jsonrpc_session_send( - txn->idl->session, - jsonrpc_create_request( - "transact", operations, &txn->request_id)) - ? TXN_TRY_AGAIN - : TXN_INCOMPLETE); + if (!any_updates) { + txn->status = TXN_SUCCESS; + } else if (!jsonrpc_session_send( + txn->idl->session, + jsonrpc_create_request( + "transact", operations, &txn->request_id))) { + hmap_insert(&txn->idl->outstanding_txns, &txn->hmap_node, + json_hash(txn->request_id, 0)); + } else { + txn->status = TXN_INCOMPLETE; + } - hmap_insert(&txn->idl->outstanding_txns, &txn->hmap_node, - json_hash(txn->request_id, 0)); txn->idl->txn = NULL; - ovsdb_idl_txn_disassemble(txn); - if (status != TXN_INCOMPLETE) { - ovsdb_idl_txn_complete(txn, status); - } return txn->status; }