// each message, 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 likely a bounced message, possibly 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. Treat as irrecoverable.
- 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);
}
jsonObjectSetKey(msg_wrapper, "log_xid", jsonNewObject(tmsg->osrf_xid));
jsonObjectSetKey(msg_wrapper, "osrf_msg", jsonParseRaw(tmsg->body));
+ if (tmsg->is_error) {
+ // tmsg->sender is the original recipient. they get swapped
+ // in error replies.
+ osrfLogError(OSRF_LOG_MARK,
+ "WS received XMPP error message in response to thread=%s and "
+ "recipient=%s. Likely the recipient is not accessible/available.",
+ tmsg->thread, tmsg->sender);
+ jsonObjectSetKey(msg_wrapper, "transport_error", jsonNewBoolObject(1));
+ }
+
msg_string = jsonObjectToJSONRaw(msg_wrapper);
// Send the JSON to STDOUT