dp_doom: fix silly bug causing only the first frame to be published

This commit is contained in:
oxmox 2023-02-19 12:40:26 +01:00
parent c292aadb68
commit 9e857180be

View file

@ -228,10 +228,9 @@ void IB_FinishUpdate (void)
{ {
if (!dp_nng_is_timeout(res)) if (!dp_nng_is_timeout(res))
dp_nng_fatal("doom/recvmsg", res); dp_nng_fatal("doom/recvmsg", res);
return;
} }
else
{
MessageBase *msgBase = DP_NNG_BODY_AS(msg, MessageBase); MessageBase *msgBase = DP_NNG_BODY_AS(msg, MessageBase);
DP_DoomCommand cmd = DP_DC_Noop; DP_DoomCommand cmd = DP_DC_Noop;
@ -253,6 +252,7 @@ void IB_FinishUpdate (void)
if (cmd == DP_DC_Endoom) if (cmd == DP_DC_Endoom)
{ {
log_info("Received Endoom from controller, quitting");
ctx->state = DP_DS_Endoom; ctx->state = DP_DS_Endoom;
if ((res = publish_state(ctx))) if ((res = publish_state(ctx)))
@ -262,6 +262,7 @@ void IB_FinishUpdate (void)
return; return;
} }
} }
}
{ {
int res = 0; int res = 0;
@ -279,7 +280,7 @@ void IB_FinishUpdate (void)
if ((res = nng_sendmsg(ctx->pub, msg, 0))) if ((res = nng_sendmsg(ctx->pub, msg, 0)))
dp_nng_fatal("ctrl/sendmsg", res); dp_nng_fatal("ctrl/sendmsg", res);
log_debug("doom(%d) published frame", ctx->id); log_trace("doom(%d) published frame", ctx->id);
} }
} }
@ -294,6 +295,7 @@ static void I_Quit_Wrapper(int dummy)
{ {
(void)dummy; (void)dummy;
log_info("Caught SIGINT, quitting");
I_Quit(); I_Quit();
} }
@ -311,11 +313,7 @@ void IB_InitGraphics(const char *title, size_t screen_width, size_t screen_heigh
signal(SIGINT, I_Quit_Wrapper); signal(SIGINT, I_Quit_Wrapper);
#ifndef NDEBUG log_set_level(LOG_TRACE);
log_set_level(LOG_DEBUG);
#else
log_set_level(LOG_INFO);
#endif
dp_nng_init_limits(1, 1, 1); dp_nng_init_limits(1, 1, 1);
@ -346,7 +344,10 @@ void IB_InitGraphics(const char *title, size_t screen_width, size_t screen_heigh
} }
if (ctx->state == DP_DS_Endoom) if (ctx->state == DP_DS_Endoom)
{
log_info("Received Endoom from controller, quitting");
I_Quit(); I_Quit();
}
} }
void IB_ShutdownGraphics(void) void IB_ShutdownGraphics(void)