static int process_server_input(int fd, struct xmpp *xmpp) { char buf[BUF_BYTES]; int n, remain; do { n = io_recv(sizeof(buf), buf, &remain, &fd); if (n <= 0) return -1; if (xmpp_process_input(n, buf, xmpp, xmpp)) return -1; } while (remain > 0); return 0; }
static int process_server_input(int fd, struct xmpp *xmpp) { char buf[DATA_BUF]; int n, remain; do { n = io_recv(sizeof(buf), buf, &remain, &fd); if (n < 0) { print_msg(0, "", "; error: reading from socket (remain: %d)\n", remain); return -1; } log_printf(20, "; processing state: '%d' buf: '%.*s'\n", xmpp->xml.state, n, buf); if (xmpp_process_input(n, buf, xmpp, xmpp)) { print_msg(0, "", "; error: processing xmpp xml\n"); log_printf(20, "; state: '%d' buf: '%.*s'\n", xmpp->xml.state, n, buf); return -1; } } while (remain > 0); return 0; }