From 83a6b503812e4f17ea2eab10c7ae1ade6427f821 Mon Sep 17 00:00:00 2001
From: Eric Wong <e@80x24.org>
Date: Thu, 31 Mar 2016 03:33:59 +0000
Subject: [PATCH] httpd: remove reference to callback during close

Avoid wasting memory and the risk of a potential reference
cycles by dropping the callback ASAP.
---
 script/public-inbox-httpd | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/script/public-inbox-httpd b/script/public-inbox-httpd
index e7ed3c9d..3ca974c9 100755
--- a/script/public-inbox-httpd
+++ b/script/public-inbox-httpd
@@ -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;
-- 
2.51.0