From 00b9d96b77e65581dbbd286bc143eaaab51fab2e Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 7 May 2010 21:53:11 +0000 Subject: [PATCH] * Modified the XMPP service to use client_read_random_blob(). However, I noticed that client_read_random_blob() is always returning only one byte. --- citadel/modules/xmpp/serv_xmpp.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/citadel/modules/xmpp/serv_xmpp.c b/citadel/modules/xmpp/serv_xmpp.c index 067faa0a1..c553f2419 100644 --- a/citadel/modules/xmpp/serv_xmpp.c +++ b/citadel/modules/xmpp/serv_xmpp.c @@ -476,23 +476,21 @@ void xmpp_greeting(void) { /* * Main command loop for XMPP sessions. - * Right now we're reading one byte at a time and sending it to the XML parser. - * There's got to be a better way to do this. */ void xmpp_command_loop(void) { - char cmdbuf[2]; - int retval; + int rc; + StrBuf *stream_input = NewStrBuf(); time(&CC->lastcmd); - memset(cmdbuf, 0, sizeof cmdbuf); - retval = client_read(cmdbuf, 1); - if (retval != 1) { + rc = client_read_random_blob(stream_input, 30); + if (rc > 0) { + XML_Parse(XMPP->xp, ChrPtr(stream_input), rc, 0); + } + else { CtdlLogPrintf(CTDL_ERR, "Client disconnected: ending session.\n"); CC->kill_me = 1; - return; } - - XML_Parse(XMPP->xp, cmdbuf, 1, 0); + FreeStrBuf(&stream_input); } -- 2.30.2