(ack *types.SignedAckHeader)
| 78 | } |
| 79 | |
| 80 | func (i *multiAckIndex) remove(ack *types.SignedAckHeader) (err error) { |
| 81 | var key = ack.GetQueryKey() |
| 82 | log.Debugf("removing key %s -x- ack %s", &key, ack.Hash()) |
| 83 | i.Lock() |
| 84 | defer i.Unlock() |
| 85 | if _, ok := i.respIndex[key]; ok { |
| 86 | delete(i.respIndex, key) |
| 87 | atomic.AddInt32(&i.owner.responseCount, -1) |
| 88 | return |
| 89 | } |
| 90 | if oack, ok := i.ackIndex[key]; ok { |
| 91 | if oack.Hash() != ack.Hash() { |
| 92 | err = errors.Wrapf( |
| 93 | ErrMultipleAckOfSeqNo, "remove key %s -x- ack %s", &key, ack.Hash()) |
| 94 | return |
| 95 | } |
| 96 | delete(i.ackIndex, key) |
| 97 | atomic.AddInt32(&i.owner.ackCount, -1) |
| 98 | return |
| 99 | } |
| 100 | err = errors.Wrapf(ErrQueryNotFound, "remove key %s -x- ack %s", &key, ack.Hash()) |
| 101 | return |
| 102 | } |
| 103 | |
| 104 | func (i *multiAckIndex) acks() (ret []*types.SignedAckHeader) { |
| 105 | i.RLock() |
no test coverage detected