From a3c85c0224009fefbb76f2bfcb05dc36cc5ccfed Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 11 Jun 2018 12:41:52 -0400 Subject: [PATCH] Websocket stdio / websocketd experiment Signed-off-by: Bill Erickson --- src/websocket-stdio/osrf-websocket-stdio.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/websocket-stdio/osrf-websocket-stdio.c b/src/websocket-stdio/osrf-websocket-stdio.c index 3ea2825..4474c96 100644 --- a/src/websocket-stdio/osrf-websocket-stdio.c +++ b/src/websocket-stdio/osrf-websocket-stdio.c @@ -496,9 +496,21 @@ static void read_from_osrf() { // Once client_recv is called all data waiting on the socket is read. // This means we can't return to the main select() loop after each message, - // because any subsequent messages will get stuck in the opensrf queue. - // Instead, process all available messages. + // because any subsequent messages will get stuck in the opensrf receive + // queue. Process all available messages. while ( (tmsg = client_recv(osrf_handle, 0)) ) { + + if (tmsg->is_error) { + // tmsg here is bounced message, likely the result of a XMPP + // cancel code 503 (forbidden) from an attempt to send a + // message to a service that's not available on the public + // XMPP domain. Recovery not possible. + osrfLogError(OSRF_LOG_MARK, + "WS XMPP error [%d] occured, exiting", tmsg->error_code); + shut_it_down(1); + return; + } + read_one_osrf_message(tmsg); message_free(tmsg); } -- 2.11.0