X-Git-Url: https://git.cworth.org/git?p=loudgame;a=blobdiff_plain;f=loudgame.c;h=65aeb35f31ab95cfe420dbfb526b874b6997f452;hp=2cb9a1869f62e16160909a4fad2add98524abb7e;hb=6e8ab3d68b2c0e5c9874a3d2f4ba34de56efa6b8;hpb=0df3d3dd2384f2606ad5e037c925cb88a5f30fef diff --git a/loudgame.c b/loudgame.c index 2cb9a18..65aeb35 100644 --- a/loudgame.c +++ b/loudgame.c @@ -33,11 +33,16 @@ loudgame_quit (loudgame_t *lg, int return_value) lg->return_value = return_value; - if (! lm_connection_close (lg->connection, &error)) - g_print ("An error occurred during lm_connection_close: %s\n", - error->message); - - lm_connection_unref (lg->connection); + if (lg->connection) + { + if (! lm_connection_close (lg->connection, &error)) + { + g_print ("An error occurred during lm_connection_close: %s\n", + error->message); + } + lm_connection_unref (lg->connection); + lg->connection = NULL; + } g_main_loop_quit (lg->main_loop); } @@ -200,6 +205,11 @@ make_connection (gpointer closure) loudgame_quit (lg, 1); } + /* It seems to be necessary to explicitly tell the server we're + * still here. Let's see if one keep-alive every 60 seconds is + * sufficient. */ + lm_connection_set_keep_alive_rate (lg->connection, 60); + /* Return false to not schedule another call. */ return 0; }