LP#1341687 listeners log/drop XMPP error msgs
authorBill Erickson <berick@esilibrary.com>
Thu, 17 Jul 2014 15:37:53 +0000 (11:37 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Wed, 20 Aug 2014 21:06:45 +0000 (14:06 -0700)
The most common form of XMPP error messages are "bounced" messages, i.e.
those where the recipient is not available.  Instead of passing these
useless and confusing messages down to a drone for processing, log the
error in the listener and drop the message.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>

src/libopensrf/osrf_prefork.c
src/perl/lib/OpenSRF/Server.pm

index 6409e6b..658fd8c 100644 (file)
@@ -869,6 +869,15 @@ static void prefork_run( prefork_simple* forker ) {
                        continue;
         }
 
+        if (cur_msg->error_type) {
+            osrfLogInfo(OSRF_LOG_MARK, 
+                "Listener received an XMPP error message.  "
+                "Likely a bounced message. sender=%s", cur_msg->sender);
+            if(child_dead)
+                reap_children(forker);
+            continue;
+        }
+
                message_prepare_xml( cur_msg );
                const char* msg_data = cur_msg->msg_xml;
                if( ! msg_data || ! *msg_data ) {
index 48197a7..dcf44fe 100644 (file)
@@ -167,7 +167,11 @@ sub run {
 
         if($msg) {
 
-            if(my $child = pop(@{$self->{idle_list}})) {
+            if ($msg->type and $msg->type eq 'error') {
+                $logger->info("server: Listener received an XMPP error ".
+                    "message.  Likely a bounced message. sender=".$msg->from);
+
+            } elsif(my $child = pop(@{$self->{idle_list}})) {
 
                 # we have an idle child to handle the request
                 $chatty and $logger->internal("server: passing request to idle child $child");