From 1d7f2da4a4129baff762f1c59da1dd47dbbc5dc5 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 5 Aug 2013 09:56:02 +0200 Subject: [PATCH] exit if spice_server_init fails (socket already in use?) --- Makefile | 4 ++++ test_display_base.c | 5 ++++- test_display_no_ssl.c | 8 +++----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index aab4860..84f359c 100644 --- a/Makefile +++ b/Makefile @@ -7,3 +7,7 @@ all: ${PROGRAMS} test_display_no_ssl: ${SOURCES} ${HEADERS} gcc ${SOURCES} -o $@ $(shell pkg-config --cflags --libs spice-protocol,spice-server) + +.PHONY: test +test: test_display_no_ssl + ./test_display_no_ssl & remote-viewer spice://localhost:5912 diff --git a/test_display_base.c b/test_display_base.c index 7e314eb..5cee771 100644 --- a/test_display_base.c +++ b/test_display_base.c @@ -861,7 +861,10 @@ Test *test_new(SpiceCoreInterface *core) printf("TESTER: listening on port %d (unsecure)\n", port); spice_server_set_port(server, port); spice_server_set_noauth(server); - spice_server_init(server, core); + int res = spice_server_init(server, core); + if (res != 0) { + g_error("spice_server_init failed, res = %d\n", res); + } cursor_init(); path_init(&path, 0, angle_parts); diff --git a/test_display_no_ssl.c b/test_display_no_ssl.c index 4a7babf..5359e66 100644 --- a/test_display_no_ssl.c +++ b/test_display_no_ssl.c @@ -7,19 +7,17 @@ */ #include +#include #include "test_display_base.h" SpiceCoreInterface *core; SpiceTimer *ping_timer; -void show_channels(SpiceServer *server); - -int ping_ms = 100; +int ping_ms = 1000; void pinger(void *opaque) { - // show_channels is not thread safe - fails if disconnections / connections occur - //show_channels(server); + printf("TEST PINGER\n"); core->timer_start(ping_timer, ping_ms); } -- 2.39.2