X-Git-Url: https://git.cworth.org/git?p=loudgame;a=blobdiff_plain;f=loudgame.c;h=d99a0d2e3677ba039b6bfa950870770e2d64ef9f;hp=e2f0af2d5b751968725dfdd427b2e08b93e8f059;hb=de3821affac7e91dc7c8692716550f7fbfe5a57f;hpb=1b9383bc1758fa4b49ab029c730b7ba434b0f7ad diff --git a/loudgame.c b/loudgame.c index e2f0af2..d99a0d2 100644 --- a/loudgame.c +++ b/loudgame.c @@ -93,6 +93,36 @@ loudgame_send (loudgame_t *lg, } } +void +loudgame_vsendf (loudgame_t *lg, + const char *peer, + const char *format, + va_list va) +{ + char *str; + + str = g_strdup_vprintf (format, va); + + loudgame_send (lg, peer, str); + + free (str); +} + +void +loudgame_sendf (loudgame_t *lg, + const char *peer, + const char *format, + ...) +{ + va_list va; + + va_start (va, format); + + loudgame_vsendf (lg, peer, format, va); + + va_end (va); +} + static void handle_command (LmConnection *connection, const char *peer, @@ -170,6 +200,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; }