Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/Net/XMPP/PrivacyLists.pm
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ sub new
sub init
{
my $self = shift;
weaken $self;

$self->{CONNECTION}-> SetXPathCallBacks('/iq[@type="result" or @type="set"]/query[@xmlns="jabber:iq:privacy"]'=>sub{ $self->handler(@_) });
}
Expand Down
4 changes: 4 additions & 0 deletions lib/Net/XMPP/Protocol.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1851,6 +1851,7 @@ sub MessageSend
sub PresenceDB
{
my $self = shift;
weaken $self;

$self->SetXPathCallBacks('/presence'=>sub{ shift; $self->PresenceDBParse(@_) });
}
Expand Down Expand Up @@ -2710,6 +2711,7 @@ sub Roster
sub RosterDB
{
my $self = shift;
weaken $self;

$self->SetXPathCallBacks('/iq[@type="result" or @type="set"]/query[@xmlns="jabber:iq:roster"]'=>sub{ shift; $self->RosterDBParse(@_) });
}
Expand Down Expand Up @@ -2993,6 +2995,7 @@ sub RosterDBRemove
sub TLSInit
{
my $self = shift;
weaken $self;

$TLS_CALLBACK = sub{ $self->ProcessTLSStanza( @_ ) };
$self->SetDirectXPathCallBacks('/[@xmlns="'.&ConstXMLNS("xmpp-tls").'"]'=>$TLS_CALLBACK);
Expand Down Expand Up @@ -3181,6 +3184,7 @@ sub TLSSendStartTLS
sub SASLInit
{
my $self = shift;
weaken $self;

$SASL_CALLBACK = sub{ $self->ProcessSASLStanza( @_ ) };
$self->SetDirectXPathCallBacks('/[@xmlns="'.&ConstXMLNS("xmpp-sasl").'"]'=> $SASL_CALLBACK);
Expand Down
21 changes: 10 additions & 11 deletions t/gtalk.t
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ BEGIN {
}

my $repeat = 5;
plan tests => 2 + 6 * $repeat;
plan tests => 9 + 6 * $repeat;

# TODO ask user if it is ok to do network tests!
print_size('before loading Net::XMPP');
Expand Down Expand Up @@ -90,17 +90,16 @@ for (2..$repeat) {
}

# The leakage shown here happens even before Authentication is called
#SKIP: {
# skip 'Devel::LeakGuard::Object is needed', 1 if not $leak_guard;
# my $warn;
# local $SIG{__WARN__} = sub { $warn = shift };
# leakguard {
# run();
# };
#
# ok(!$warn, 'leaking') or diag $warn;
#}
my $warn;
SKIP: {
skip 'Devel::LeakGuard::Object is needed', 6 if not $leak_guard;
local $SIG{__WARN__} = sub { $warn = shift };
leakguard {
run();
};
}

ok(!$warn, 'leaking') or diag $warn;

# as I can see setting up the connection leaks in the first 5 attempts
# and then it stops leaking. I tried it with repeate=25
Expand Down
3 changes: 0 additions & 3 deletions t/memory_leak.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ check_leak(
'nothing',
);

TODO: {
local $TODO = 'fix leak';
check_leak(
sub {
my $conn = Net::XMPP::Client->new;
Expand All @@ -46,7 +44,6 @@ check_leak(
},
'connect',
);
}


sub check_leak{
Expand Down