]> Sergey Matveev's repositories - public-inbox.git/commitdiff
httpd: remove reference to callback during close
authorEric Wong <e@80x24.org>
Thu, 31 Mar 2016 03:33:59 +0000 (03:33 +0000)
committerEric Wong <e@80x24.org>
Thu, 31 Mar 2016 03:34:18 +0000 (03:34 +0000)
Avoid wasting memory and the risk of a potential reference
cycles by dropping the callback ASAP.

script/public-inbox-httpd

index e7ed3c9df4fa1e122dd1714cea5678e9d2e56ab6..3ca974c9a780e1b101661691930a407a4d2345ef 100755 (executable)
@@ -82,6 +82,12 @@ sub event_hup { $_[0]->{cb}->() }
 sub event_err { $_[0]->{cb}->() }
 sub sysread { shift->{sock}->sysread(@_) }
 
+sub close {
+       my $self = shift;
+       $self->{cb} = undef;
+       $self->SUPER::close(@_);
+}
+
 1;
 
 package PublicInbox::HTTPD;