From: Bill Erickson Date: Thu, 17 Jul 2014 15:37:53 +0000 (-0400) Subject: LP#1341687 listeners log/drop XMPP error msgs X-Git-Tag: osrf_rel_2_4_0-alpha~9 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6cdd5251ac64651534e579f7e02a70a665f60283;p=OpenSRF.git LP#1341687 listeners log/drop XMPP error msgs 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 Signed-off-by: Galen Charlton --- diff --git a/src/libopensrf/osrf_prefork.c b/src/libopensrf/osrf_prefork.c index 6409e6b..658fd8c 100644 --- a/src/libopensrf/osrf_prefork.c +++ b/src/libopensrf/osrf_prefork.c @@ -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 ) { diff --git a/src/perl/lib/OpenSRF/Server.pm b/src/perl/lib/OpenSRF/Server.pm index 48197a7..dcf44fe 100644 --- a/src/perl/lib/OpenSRF/Server.pm +++ b/src/perl/lib/OpenSRF/Server.pm @@ -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");