fix nil source on chunk

This commit is contained in:
zelig 2015-05-13 21:49:36 +02:00
parent e2887da4c4
commit 46aa7db5fd
3 changed files with 4 additions and 8 deletions

View file

@ -61,7 +61,7 @@ type Chunk struct {
req *requestStatus //
wg *sync.WaitGroup
dbStored chan bool
source peer
source *peer
}
type ChunkStore interface {

View file

@ -114,7 +114,7 @@ func (self *NetStore) addStoreRequest(req *storeRequestMsgData) {
} else {
return
}
chunk.source = req.peer
chunk.source = &req.peer
self.put(chunk)
}
@ -295,7 +295,7 @@ func (self *NetStore) store(chunk *Chunk) {
Id: uint64(id),
}
for _, peer := range self.hive.getPeers(chunk.Key, 0) {
if peer.Addr() != chunk.source.Addr() {
if chunk.source == nil || peer.Addr() != chunk.source.Addr() {
go peer.store(req)
}
}

View file

@ -468,11 +468,7 @@ func (s *Ethereum) Start() error {
if s.DPA != nil {
s.DPA.Start()
selfNode := s.net.Self()
if selfNode == nil {
panic("self is nil")
}
s.netStore.Start(selfNode)
s.netStore.Start(s.net.Self())
go bzz.StartHttpServer(s.DPA)
}