strategyUpdateRequest returns message type

This commit is contained in:
zelig 2015-02-05 13:19:56 +01:00
parent 0da3b36175
commit e6e6964e5a

View file

@ -81,18 +81,19 @@ this is the most simplistic implementation:
- respond with peers and timeout if still searching
! in the last case as well, we should respond with reject if already got requesterCount peers with that exact id
*/
func (self *Hive) strategyUpdateRequest(rs *requestStatus, req *retrieveRequestMsgData) (send bool, timeout time.Time) {
func (self *Hive) strategyUpdateRequest(rs *requestStatus, req *retrieveRequestMsgData) (msgTyp int, timeout time.Time) {
switch rs.status {
case reqSearching:
self.addRequester(rs, req)
timeout = self.searchTimeout(rs, req)
if self.addRequester(rs, req) {
msgTyp = peersMsg
timeout = self.searchTimeout(rs, req)
}
case reqTimedOut:
msgTyp = peersMsg
case reqFound:
if self.addRequester(rs, req) {
send = true
} else {
// timeout = time.Time(0)
msgTyp = storeRequestMsg
}
}
return