[Opensrf-commits] r1713 - in branches/rel_1_0/src/perl/lib/OpenSRF: . DomainObject Transport/SlimJabber (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jun 3 11:59:36 EDT 2009
Author: erickson
Date: 2009-06-03 11:59:34 -0400 (Wed, 03 Jun 2009)
New Revision: 1713
Modified:
branches/rel_1_0/src/perl/lib/OpenSRF/AppSession.pm
branches/rel_1_0/src/perl/lib/OpenSRF/DomainObject/oilsMessage.pm
branches/rel_1_0/src/perl/lib/OpenSRF/Transport/SlimJabber/XMPPReader.pm
Log:
flush_socket now flushes data through the xml stream parser to prevent the destorying the validity of the stream. now discarding RESULT messages passed to server sessions.
Modified: branches/rel_1_0/src/perl/lib/OpenSRF/AppSession.pm
===================================================================
--- branches/rel_1_0/src/perl/lib/OpenSRF/AppSession.pm 2009-06-03 15:58:20 UTC (rev 1712)
+++ branches/rel_1_0/src/perl/lib/OpenSRF/AppSession.pm 2009-06-03 15:59:34 UTC (rev 1713)
@@ -947,11 +947,14 @@
$self->session->send( 'STATUS',$msg, $self->threadTrace );
}
-sub stream_push {
- my $self = shift;
- my $msg = shift;
- $self->respond( $msg );
-}
+# TODO stream_push only works when server sessions can accept RESULT
+# messages, which is no longer supported. Create a new OpenSRF message
+# type to support client-to-server streams.
+#sub stream_push {
+# my $self = shift;
+# my $msg = shift;
+# $self->respond( $msg );
+#}
sub respond {
my $self = shift;
Modified: branches/rel_1_0/src/perl/lib/OpenSRF/DomainObject/oilsMessage.pm
===================================================================
--- branches/rel_1_0/src/perl/lib/OpenSRF/DomainObject/oilsMessage.pm 2009-06-03 15:58:20 UTC (rev 1712)
+++ branches/rel_1_0/src/perl/lib/OpenSRF/DomainObject/oilsMessage.pm 2009-06-03 15:59:34 UTC (rev 1713)
@@ -221,11 +221,11 @@
sub do_server {
my( $self, $session, $mtype, $api_level, $tT ) = @_;
- # A Server should never receive STATUS messages. If so, we drop them.
- # This is to keep STATUS's from dead client sessions from creating new server
+ # A Server should never receive STATUS or RESULT messages. If so, we drop them.
+ # This is to keep STATUS/RESULT's from dead client sessions from creating new server
# sessions which send mangled session exceptions to backends for messages
# that they are not aware of any more.
- if( $mtype eq 'STATUS' ) { return 0; }
+ if( $mtype eq 'STATUS' or $mtype eq 'RESULT' ) { return 0; }
if ($mtype eq 'DISCONNECT') {
Modified: branches/rel_1_0/src/perl/lib/OpenSRF/Transport/SlimJabber/XMPPReader.pm
===================================================================
--- branches/rel_1_0/src/perl/lib/OpenSRF/Transport/SlimJabber/XMPPReader.pm 2009-06-03 15:58:20 UTC (rev 1712)
+++ branches/rel_1_0/src/perl/lib/OpenSRF/Transport/SlimJabber/XMPPReader.pm 2009-06-03 15:59:34 UTC (rev 1713)
@@ -321,32 +321,22 @@
}
}
+
+# read all the data on the jabber socket through the
+# parser and drop the resulting message
sub flush_socket {
my $self = shift;
- my $socket = $self->socket;
- return 0 unless $socket and $socket->connected;
+ return 0 unless $self->connected;
- my $flags = fcntl($socket, F_GETFL, 0);
- fcntl($socket, F_SETFL, $flags | O_NONBLOCK);
-
- while( my $n = sysread( $socket, my $buf, 8192 ) ) {
- $logger->debug("flush_socket dropped $n bytes of data");
- $logger->error("flush_socket dropped data on disconnected socket: $buf")
- unless($socket->connected);
+ while ($self->wait(0)) {
+ # TODO remove this log line
+ $logger->info("flushing data from socket...");
}
- fcntl($socket, F_SETFL, $flags);
- return 0 unless $socket->connected;
- return 1;
+ return $self->connected;
}
-
-
1;
-
-
-
-
More information about the opensrf-commits
mailing list