From 8a9ebd6320907ca943b2630baea33e8ee60e668f Mon Sep 17 00:00:00 2001 From: bustico Date: Thu, 4 Mar 2010 09:37:55 +0000 Subject: fix: an internal table used to send direct message was not updated when application disconnects. --- Ivy.pm | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'Ivy.pm') diff --git a/Ivy.pm b/Ivy.pm index d64c60f..2ed610f 100644 --- a/Ivy.pm +++ b/Ivy.pm @@ -1883,12 +1883,23 @@ sub _removeFileDescriptor ($$$) # $fd->peerport())); &$fileEventFunc ($fd, '') ; delete $self->[sendRegList]->{$fd}; + delete $self->[sendRegListSrc]->{$fd}; delete $self->[sockList]->{$fd}; delete $self->[bufRecByCnnx]->{$fd}; delete $self->[bufEmiByCnnx]->{$fd}; $fd->close(); + # remove all occurence of fd from $self->[appliList] + foreach my $name (keys %{$self->[appliList]}) { + for (my $i=0; $i < scalar (@{$self->[appliList]{$name}}); $i++) { + my $fdp = $self->[appliList]{$name}->[$i]; + if ($fd eq $fdp) { + delete ($self->[appliList]{$name}->[$i]); + } + } + } + unless (defined $diedAppName) { warn "Ivy::__removeFileDescriptor (called by $callBy) : disconnection of NONAME\n" if $^W; return; @@ -1962,8 +1973,10 @@ TABLE DE REGEXPS : EOF foreach my $appSock (keys %{$self->[sendRegListSrc]}) { -# my $appName = $self->_getNameByFileDes ($appSock); - print $fh "POUR l'application $nameByHandle{$appSock} : \n"; + my $appName = $self->_getNameByFileDes ($appSock); +# my $ap2 = $self->[cnnxion]{$nameByHandle{$appSock}}; +# $ap2 =~ s/^\004//g; + print $fh "POUR l'application ${appName}[$nameByHandle{$appSock}] : \n"; print $fh join ("\n", @{$self->[sendRegListSrc]{$appSock}}); print $fh "\n-----------------------------------\n"; } @@ -2041,6 +2054,10 @@ sub _univSend ($$$) { my ($self, $fd, $msg) = @_; + unless (defined $fd) { + carp "WARN _univSend fd is undefined, message will not be sent\n" if $^W; + afficher la call stack + } my $bufEmiRef = \($self->[bufEmiByCnnx]->{$fd}); my $enCongestion = $$bufEmiRef ? 1 : 0; if (ref $msg) { @@ -2355,7 +2372,7 @@ sub _getNameByFileDes ($$) EXT_LOOP: foreach my $name (keys %{$self->[appliList]}) { foreach my $fdp (@{$self->[appliList]{$name}}) { - if ($fd == $fdp) { + if ($fd eq $fdp) { $appName = $name; last EXT_LOOP; } -- cgit v1.1