user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH] httpd: remove reference to callback during close
@ 2016-03-31  3:33  7% Eric Wong
  0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2016-03-31  3:33 UTC (permalink / raw)
  To: meta

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 e7ed3c9..3ca974c 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;
-- 
EW


^ permalink raw reply related	[relevance 7%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-03-31  3:33  7% [PATCH] httpd: remove reference to callback during close Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).