[OpenSRF-GIT] OpenSRF branch rel_2_0 updated. osrf_rel_2_0_1-3-g9a06421

Evergreen Git git at git.evergreen-ils.org
Tue Oct 18 09:53:22 EDT 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "OpenSRF".

The branch, rel_2_0 has been updated
       via  9a06421a90cf29e329d11aa916dd38c99e378383 (commit)
      from  5c1befa5a8b5bd9ab774077d6168da4faf8002ca (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9a06421a90cf29e329d11aa916dd38c99e378383
Author: Bill Erickson <berick at esilibrary.com>
Date:   Tue Oct 18 09:17:10 2011 -0400

    Warn when sending very large messages
    
    Depending on configuration, messages of a certain size sent through a
    Jabber server will cause the jabber server to disconnect the client.
    This change allows admins to configure a message size warning threshold.
    When a message meets or exceeds the size threshold, a warning is issued
    to the logs with the message size (in bytes) and the message recipient.
    It does not prevent the message from being delivered.  It's purely
    informational.
    
    Use 1 800 000 as the default threhold.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/examples/opensrf_core.xml.example b/examples/opensrf_core.xml.example
index a1f2498..816a20c 100644
--- a/examples/opensrf_core.xml.example
+++ b/examples/opensrf_core.xml.example
@@ -41,6 +41,9 @@ vim:et:ts=2:sw=2:
         this should match one of the <name> of the private router above -->
     <router_name>router</router_name>
 
+    <!-- Log a warning when an outbound message reaches this size in bytes -->
+    <msg_size_warn>1800000</msg_size_warn>
+
     <!-- log file settings ======================================  -->
     <!-- log to a local file -->
     <logfile>LOCALSTATEDIR/log/osrfsys.log</logfile>
diff --git a/src/perl/lib/OpenSRF/Transport/SlimJabber/Client.pm b/src/perl/lib/OpenSRF/Transport/SlimJabber/Client.pm
index 2db8be7..a3f9233 100644
--- a/src/perl/lib/OpenSRF/Transport/SlimJabber/Client.pm
+++ b/src/perl/lib/OpenSRF/Transport/SlimJabber/Client.pm
@@ -109,7 +109,15 @@ sub send {
     my $msg = OpenSRF::Transport::SlimJabber::XMPPMessage->new(@_);
     $msg->osrf_xid($logger->get_osrf_xid);
     $msg->from($self->xmpp_id);
-    $self->reader->send($msg->to_xml);
+    my $xml = $msg->to_xml;
+    { 
+        use bytes; 
+        my $len = length($xml);
+        if ($len >= $self->{msg_size_warn}) {
+            $logger->warn("Sending large message of $len bytes to " . $msg->to)
+        }
+    }
+    $self->reader->send($xml);
 }
 
 =head2 initialize
@@ -128,6 +136,8 @@ sub initialize {
 
 	my $conf = OpenSRF::Utils::Config->current;
 
+    $self->{msg_size_warn} = $conf->bootstrap->msg_size_warn || 1800000;
+
 	my $tail = "_$$";
 	$tail = "" if !$conf->bootstrap->router_name and $username eq "router";
     $resource = "$resource$tail";

-----------------------------------------------------------------------

Summary of changes:
 examples/opensrf_core.xml.example                  |    3 +++
 .../lib/OpenSRF/Transport/SlimJabber/Client.pm     |   12 +++++++++++-
 2 files changed, 14 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
OpenSRF


More information about the opensrf-commits mailing list