* FIX [broker] fix `cannot allocate an array of constant size` .
@@ -207,8 +207,6 @@ server_cb(void *arg)
nng_msg *smsg = NULL;
int rv;
- uint8_t *ptr;
-
mqtt_msg_info *msg_info;
switch (work->state) {
@@ -837,7 +835,7 @@ broker(conf *nanomq_conf)
}
}
- struct work *works[num_ctx];
+ struct work **works = nng_zalloc(num_ctx * sizeof(struct work *));
// create broker ctx
for (i = 0; i < nanomq_conf->parallel; i++) {
works[i] = proto_work_init(sock, sock,
@@ -918,8 +916,12 @@ broker(conf *nanomq_conf)
nanomq_conf->rule_eng.rdb[1]);
fdb_stop_network();
}
-
#endif
+ for (size_t i = 0; i < num_ctx; i++) {
+ nng_free(works[i], sizeof(struct work));
+ }
+ nng_free(works, num_ctx * sizeof(struct work *));
+
exit(0);
}
nng_msleep(6000);
@@ -1014,9 +1016,10 @@ print_usage(void)
}
int
-status_check(pid_t *pid)
+status_check(int *pid)
{
#ifdef NANO_PLATFORM_WINDOWS
+ (void) pid;
debug_msg("Not support on Windows\n");
return -1;
#else
