mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
Delivery of responses to retrieve requests.
This commit is contained in:
parent
d4ff64bf44
commit
8d90ea30c4
2 changed files with 9 additions and 1 deletions
|
|
@ -142,11 +142,19 @@ func (self *NetStore) addRetrieveRequest(req *retrieveRequestMsgData) {
|
||||||
defer self.lock.Unlock()
|
defer self.lock.Unlock()
|
||||||
|
|
||||||
chunk := self.get(req.Key)
|
chunk := self.get(req.Key)
|
||||||
|
if chunk.Data == nil {
|
||||||
|
chunk.req.status = reqSearching
|
||||||
|
} else {
|
||||||
|
chunk.req.status = reqFound
|
||||||
|
}
|
||||||
|
|
||||||
t := time.Now().Add(10 * time.Second)
|
t := time.Now().Add(10 * time.Second)
|
||||||
req.timeout = &t
|
req.timeout = &t
|
||||||
|
|
||||||
send, timeout := self.strategyUpdateRequest(chunk.req, req) // may change req status
|
send, timeout := self.strategyUpdateRequest(chunk.req, req) // may change req status
|
||||||
|
|
||||||
|
dpaLogger.Debugf("Is %v == %v?", send, storeRequestMsg)
|
||||||
|
|
||||||
if send == storeRequestMsg {
|
if send == storeRequestMsg {
|
||||||
self.deliver(req, chunk)
|
self.deliver(req, chunk)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -289,7 +289,7 @@ func (self *bzzProtocol) retrieve(req *retrieveRequestMsgData) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *bzzProtocol) store(req *storeRequestMsgData) {
|
func (self *bzzProtocol) store(req *storeRequestMsgData) {
|
||||||
p2p.EncodeMsg(self.rw, storeRequestMsg, req)
|
p2p.EncodeMsg(self.rw, storeRequestMsg, req.Key, req.Size, req.Data, req.Id)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *bzzProtocol) peers(req *peersMsgData) {
|
func (self *bzzProtocol) peers(req *peersMsgData) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue