From 6cdd5251ac64651534e579f7e02a70a665f60283 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 17 Jul 2014 11:37:53 -0400 Subject: [PATCH] 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 --- src/libopensrf/osrf_prefork.c | 9 +++++++++ src/perl/lib/OpenSRF/Server.pm | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) 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"); -- 2.43.2