vere: plugs a leak on the "boothack" command socket connection
but more work is needed to fully close and cleanup
@@ -826,14 +826,26 @@ _daemon_sign_hold(void)
** (as if we were a client process)
*/
void
-_boothack_cb(uv_connect_t *conn, int status)
+_boothack_cb(uv_connect_t* con_u, c3_i sas_i)
{
- u3_mojo *moj_u = conn->data;
+ u3_mojo *moj_u = con_u->data;
+ if ( 0 != sas_i ) {
+ u3l_log("boot: doom failed: %s\r\n", uv_strerror(sas_i));
+ u3_daemon_bail();
+ }
+ else {
u3_noun dom = u3nc(c3__doom, _boothack_doom());
u3_atom mat = u3ke_jam(dom);
-
u3_newt_write(moj_u, mat, 0);
+
+ c3_free(con_u);
+
+ // XX [moj_u] is leaked, newt.c doesn't give us a callback
+ // after which we could close and free it ...
+ //
+ // uv_close((uv_handle_t*)&moj_u->pyp_u, (uv_close_cb)c3_free);
+ }
}
/* _daemon_loop_init(): stuff that comes before the event loop
@@ -844,13 +856,14 @@ _daemon_loop_init()
_daemon_sign_init();
_daemon_sign_move();
- /* boot hack */
+ // boot hack: send pier %boot command via %doom cmd socket msg
+ //
{
u3_moor* mor_u = c3_malloc(sizeof(u3_moor));
- uv_connect_t *conn = c3_malloc(sizeof(uv_connect_t));
- conn->data = mor_u;
+ uv_connect_t* con_u = c3_malloc(sizeof(uv_connect_t));
+ con_u->data = mor_u;
uv_pipe_init(u3L, &mor_u->pyp_u, 0);
- uv_pipe_connect(conn, &mor_u->pyp_u, u3K.soc_c, _boothack_cb);
+ uv_pipe_connect(con_u, &mor_u->pyp_u, u3K.soc_c, _boothack_cb);
}
}
