Hi,

this patch addresses a FIXME in the code which silently disconnects if there's
a namespace mismatch.

 [EMAIL PROTECTED]:  josboum | 2008-07-27 01:07:51 +0200
 * log stream errors clearly and don't just silently disconnect
 * this addresses a FIXME

--- DJabberd/lib/DJabberd/Connection/ServerIn.pm        (revision 778)
+++ DJabberd/lib/DJabberd/Connection/ServerIn.pm (patch djabberd-streamerror-diagnostics level 1)
@@ -22,8 +22,16 @@
 sub on_stream_start {
     my ($self, $ss) = @_;
     $self->{in_stream} = 1;
- return $self->close unless $ss->xmlns eq $self->namespace; # FIXME: should be stream error

+    ### namespace mismatch is a streamerror
+    unless( $ss->xmlns eq $self->namespace ) {
+        $self->stream_error(
+            sprintf "namespace mismatch: client->%s server->%s",
+            $ss->xmlns, $self->namespace
+        );
+        $self->close;
+    }
+
     if ($ss->announced_dialback) {
         $self->{announced_dialback} = 1;
         $self->start_stream_back($ss,

While in the process of improving diagnostics, i made the below change, which makes the anonymous sub show up by name in a stacktrace, rather than DJabberd::__ANON__:

 [EMAIL PROTECTED]:  josboum | 2008-07-27 00:22:59 +0200
 * improve diagnostics when using the accept handler

--- DJabberd/lib/DJabberd.pm    (revision 778)
+++ DJabberd/lib/DJabberd.pm (patch djabberd-streamerror- diagnostics level 1)
@@ -335,6 +335,8 @@
     IO::Handle::blocking($server, 0);

     my $accept_handler = sub {
+ local *__ANON__ = " Accept handler in ". __FILE__ ." on line ". __LINE__;
+
         my $csock = $server->accept;
         return unless $csock;

--

Jos Boumans http://www.linkedin.com/in/josboumans

  How do I prove I'm not crazy to people who are?



Reply via email to