From f134d89644094fc23aea0a0436eb8849eaeff624 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 3 Mar 2004 05:36:41 +0000 Subject: [PATCH] * Close chat socket if already open --- webcit/paging.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/webcit/paging.c b/webcit/paging.c index 3d879eaac..87b877076 100644 --- a/webcit/paging.c +++ b/webcit/paging.c @@ -117,7 +117,25 @@ void page_user(void) */ void do_chat(void) { + char buf[SIZ]; + + /* First, check to make sure we're still allowed in this room. */ + serv_printf("GOTO %s", WC->wc_roomname); + serv_gets(buf); + if (buf[0] != '2') { + smart_goto("_BASEROOM_"); + return; + } + + /* If the chat socket is still open from a previous chat, + * close it -- because it might be stale or in the wrong room. + */ + if (WC->chat_sock < 0) { + close(WC->chat_sock); + WC->chat_sock = (-1); + } + /* Ok, we're good. Here we go. */ output_headers(3); wprintf("
" -- 2.39.2