swarm: remove commented out code

This commit is contained in:
Anton Evangelatov 2018-04-23 12:16:37 +02:00
parent 7785f29b6b
commit 3006eb768f
4 changed files with 6 additions and 28 deletions

View file

@ -574,20 +574,7 @@ func (s *Server) HandleGet(w http.ResponseWriter, r *Request) {
contentType = typ contentType = typ
} }
w.Header().Set("Content-Type", contentType) w.Header().Set("Content-Type", contentType)
http.ServeContent(w, &r.Request, "", time.Now(), reader)
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)
case r.uri.Hash(): case r.uri.Hash():
w.Header().Set("Content-Type", "text/plain") w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
@ -841,17 +828,6 @@ func (s *Server) HandleGetFile(w http.ResponseWriter, r *Request) {
return 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) w.Header().Set("Content-Type", contentType)
http.ServeContent(w, &r.Request, "", time.Now(), reader) http.ServeContent(w, &r.Request, "", time.Now(), reader)

View file

@ -120,7 +120,7 @@ func (p *Peer) SendOfferedHashes(s *server, f, t uint64) error {
To: to, To: to,
Stream: s.stream, 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) return p.SendPriority(msg, s.priority)
} }

View file

@ -21,6 +21,7 @@ import (
"strconv" "strconv"
"time" "time"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/swarm/storage" "github.com/ethereum/go-ethereum/swarm/storage"
) )
@ -129,7 +130,7 @@ func (s *SwarmSyncerServer) SetNextBatch(from, to uint64) ([]byte, uint64, uint6
ticker.Stop() 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 return batch, from, to, nil, nil
} }

View file

@ -21,6 +21,7 @@ package storage
import ( import (
"sync" "sync"
"github.com/ethereum/go-ethereum/log"
lru "github.com/hashicorp/golang-lru" lru "github.com/hashicorp/golang-lru"
) )
@ -54,7 +55,7 @@ func NewMemStore(params *StoreParams, _ *LDBStore) (m *MemStore) {
} }
requestEvicted := func(key interface{}, value interface{}) { 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) r, err := lru.NewWithEvict(int(params.ChunkRequestsCacheCapacity), requestEvicted)
if err != nil { if err != nil {