[OpenSRF-GIT] OpenSRF branch master updated. 07b5a335656be741353ab70c1d4717dacdbebc1b
Evergreen Git
git at git.evergreen-ils.org
Tue Oct 18 09:51:58 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, master has been updated
via 07b5a335656be741353ab70c1d4717dacdbebc1b (commit)
from ffb8bb73a2f505cfda9d8b97fab1f82aa3fb7097 (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 07b5a335656be741353ab70c1d4717dacdbebc1b
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