diff --git a/swarm/api/http/server.go b/swarm/api/http/server.go index 54d68ca81f..c5f97ab775 100644 --- a/swarm/api/http/server.go +++ b/swarm/api/http/server.go @@ -574,20 +574,7 @@ func (s *Server) HandleGet(w http.ResponseWriter, r *Request) { contentType = typ } w.Header().Set("Content-Type", contentType) - - var res []byte - var err error - res, err = ioutil.ReadAll(reader) - if err != nil { - log.Error("handle.get", "ruid", r.ruid, "error", err) - Respond(w, r, fmt.Sprintf("chunk not found: %s", err), http.StatusNotFound) - return - } - log.Debug("handle.get.readall success", "ruid", r.ruid) - - rdr := bytes.NewReader(res) - - http.ServeContent(w, &r.Request, "", time.Now(), rdr) + http.ServeContent(w, &r.Request, "", time.Now(), reader) case r.uri.Hash(): w.Header().Set("Content-Type", "text/plain") w.WriteHeader(http.StatusOK) @@ -841,17 +828,6 @@ func (s *Server) HandleGetFile(w http.ResponseWriter, r *Request) { return } - //var res []byte - //res, err = ioutil.ReadAll(reader) - //if err != nil { - //log.Error("handle.get.file", "ruid", r.ruid, "error", err) - //Respond(w, r, fmt.Sprintf("chunk not found %s: %s", r.uri, err), http.StatusNotFound) - //return - //} - //log.Debug("handle.get.file.readall success", "ruid", r.ruid) - - //rdr := bytes.NewReader(res) - w.Header().Set("Content-Type", contentType) http.ServeContent(w, &r.Request, "", time.Now(), reader) diff --git a/swarm/network/stream/peer.go b/swarm/network/stream/peer.go index be46f32df0..79afd5d425 100644 --- a/swarm/network/stream/peer.go +++ b/swarm/network/stream/peer.go @@ -120,7 +120,7 @@ func (p *Peer) SendOfferedHashes(s *server, f, t uint64) error { To: to, Stream: s.stream, } - //log.Trace("Swarm syncer offer batch", "peer", p.ID(), "stream", s.stream, "len", len(hashes), "from", from, "to", to) + log.Trace("Swarm syncer offer batch", "peer", p.ID(), "stream", s.stream, "len", len(hashes), "from", from, "to", to) return p.SendPriority(msg, s.priority) } diff --git a/swarm/network/stream/syncer.go b/swarm/network/stream/syncer.go index 5da3eb4881..ae4071ba4e 100644 --- a/swarm/network/stream/syncer.go +++ b/swarm/network/stream/syncer.go @@ -21,6 +21,7 @@ import ( "strconv" "time" + "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/swarm/storage" ) @@ -129,7 +130,7 @@ func (s *SwarmSyncerServer) SetNextBatch(from, to uint64) ([]byte, uint64, uint6 ticker.Stop() } - //log.Debug("Swarm syncer offer batch", "po", s.po, "len", i, "from", from, "to", to, "current store count", s.db.CurrentBucketStorageIndex(s.po)) + log.Trace("Swarm syncer offer batch", "po", s.po, "len", i, "from", from, "to", to, "current store count", s.db.CurrentBucketStorageIndex(s.po)) return batch, from, to, nil, nil } diff --git a/swarm/storage/memstore.go b/swarm/storage/memstore.go index d1b9521ede..7266bc92be 100644 --- a/swarm/storage/memstore.go +++ b/swarm/storage/memstore.go @@ -21,6 +21,7 @@ package storage import ( "sync" + "github.com/ethereum/go-ethereum/log" lru "github.com/hashicorp/golang-lru" ) @@ -54,7 +55,7 @@ func NewMemStore(params *StoreParams, _ *LDBStore) (m *MemStore) { } requestEvicted := func(key interface{}, value interface{}) { - //log.Error("evict called on outgoing request") + log.Error("evict called on outgoing request") } r, err := lru.NewWithEvict(int(params.ChunkRequestsCacheCapacity), requestEvicted) if err != nil {