ganeshmurthy commented on a change in pull request #1176:
URL: https://github.com/apache/qpid-dispatch/pull/1176#discussion_r623086323
##########
File path: src/server.c
##########
@@ -1644,25 +1657,31 @@ void qd_listener_decref(qd_listener_t* li)
qd_connector_t *qd_server_connector(qd_server_t *server)
{
- qd_connector_t *ct = new_qd_connector_t();
- if (!ct) return 0;
- ZERO(ct);
- sys_atomic_init(&ct->ref_count, 1);
- ct->server = server;
- qd_failover_item_list_t conn_info_list;
- DEQ_INIT(conn_info_list);
- ct->conn_info_list = conn_info_list;
- ct->conn_index = 1;
- ct->state = CXTR_STATE_INIT;
- ct->lock = sys_mutex();
- ct->conn_msg = (char*) malloc(300);
- memset(ct->conn_msg, 0, 300);
- ct->timer = qd_timer(ct->server->qd, try_open_cb, ct);
- if (!ct->lock || !ct->timer) {
- qd_connector_decref(ct);
- return 0;
- }
- return ct;
+ qd_connector_t *connector = new_qd_connector_t();
+ if (!connector) return 0;
+ ZERO(connector);
+ sys_atomic_init(&connector->ref_count, 1);
+ DEQ_INIT(connector->conn_info_list);
+
+ connector->server = server;
Review comment:
How about initializing the timer, conn_msg, lock *first* and if those
are successful, then set server, conn_index, etc.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]