Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quick hack to prevent indefinite buildup of closenotify routines #2014

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions commands/http/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"strconv"
"strings"
"sync"
"time"

cors "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/rs/cors"
context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
Expand Down Expand Up @@ -152,6 +153,9 @@ func (i internalHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if cn, ok := w.(http.CloseNotifier); ok {
go func() {
select {
case <-time.After(time.Minute * 30):
// TODO: this is a hack to avoid these goroutines building up in memory
log.Warning("TODO: close notify needs to be fixed")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if a file is legitimately big enough + over a low bw conn to require 30min to stream? again, this needs to take into account the rate + progress. a timeout like this is ok when there havent been any bytes through (or too few)

case <-cn.CloseNotify():
case <-ctx.Done():
}
Expand Down