From a4f2d1d2f798c827bb2e869ac3ac7eda54cfaef5 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Wed, 1 Jun 2016 12:18:59 -0700 Subject: [PATCH 1/2] buffer error chan to prevent dead goro buildup License: MIT Signed-off-by: Jeromy --- namesys/publisher.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/namesys/publisher.go b/namesys/publisher.go index d8ca95623..5388583a5 100644 --- a/namesys/publisher.go +++ b/namesys/publisher.go @@ -146,7 +146,7 @@ func PutRecordToRouting(ctx context.Context, k ci.PrivKey, value path.Path, seqn entry.Ttl = proto.Uint64(uint64(ttl.Nanoseconds())) } - errs := make(chan error) + errs := make(chan error, 2) go func() { errs <- PublishEntry(ctx, r, ipnskey, entry) From 82a2218251127d85085dd68f64a6a0b3da5c99e6 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Wed, 1 Jun 2016 12:20:04 -0700 Subject: [PATCH 2/2] localize context cancellation in PutRecordToRouting License: MIT Signed-off-by: Jeromy --- namesys/publisher.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/namesys/publisher.go b/namesys/publisher.go index 5388583a5..5fdbb725a 100644 --- a/namesys/publisher.go +++ b/namesys/publisher.go @@ -135,6 +135,9 @@ func checkCtxTTL(ctx context.Context) (time.Duration, bool) { } func PutRecordToRouting(ctx context.Context, k ci.PrivKey, value path.Path, seqnum uint64, eol time.Time, r routing.IpfsRouting, id peer.ID) error { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + namekey, ipnskey := IpnsKeysForID(id) entry, err := CreateRoutingEntryData(k, value, seqnum, eol) if err != nil {