mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-04-22 08:10:10 +00:00
Bugfix : let the program terminate if connection is lost when using SDL
This commit is contained in:
committed by
Cameron Gutman
parent
f871b663b1
commit
8323eeb23c
@@ -23,6 +23,10 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_SDL
|
||||||
|
#include <SDL.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
pthread_t main_thread_id = 0;
|
pthread_t main_thread_id = 0;
|
||||||
bool connection_debug;
|
bool connection_debug;
|
||||||
ConnListenerRumble rumble_handler = NULL;
|
ConnListenerRumble rumble_handler = NULL;
|
||||||
@@ -30,6 +34,7 @@ ConnListenerRumble rumble_handler = NULL;
|
|||||||
static void connection_terminated(int errorCode) {
|
static void connection_terminated(int errorCode) {
|
||||||
switch (errorCode) {
|
switch (errorCode) {
|
||||||
case ML_ERROR_GRACEFUL_TERMINATION:
|
case ML_ERROR_GRACEFUL_TERMINATION:
|
||||||
|
printf("Connection has been terminated gracefully.\n");
|
||||||
break;
|
break;
|
||||||
case ML_ERROR_NO_VIDEO_TRAFFIC:
|
case ML_ERROR_NO_VIDEO_TRAFFIC:
|
||||||
printf("No video received from host. Check the host PC's firewall and port forwarding rules.\n");
|
printf("No video received from host. Check the host PC's firewall and port forwarding rules.\n");
|
||||||
@@ -48,6 +53,12 @@ static void connection_terminated(int errorCode) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_SDL
|
||||||
|
SDL_Event event;
|
||||||
|
event.type = SDL_QUIT;
|
||||||
|
SDL_PushEvent(&event);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (main_thread_id != 0)
|
if (main_thread_id != 0)
|
||||||
pthread_kill(main_thread_id, SIGTERM);
|
pthread_kill(main_thread_id, SIGTERM);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user