| 138 | } |
| 139 | |
| 140 | func (pool *PeerPool) peerConnected(peerIdx uint32) { |
| 141 | pool.lock.Lock() |
| 142 | defer pool.lock.Unlock() |
| 143 | |
| 144 | // new peer, rather than modify |
| 145 | pool.peers[peerIdx] = &Peer{ |
| 146 | Index: peerIdx, |
| 147 | PubKey: pool.peers[peerIdx].PubKey, |
| 148 | LastUpdateTime: time.Now(), |
| 149 | connected: true, |
| 150 | } |
| 151 | if C, present := pool.peerConnectionWaitings[peerIdx]; present { |
| 152 | delete(pool.peerConnectionWaitings, peerIdx) |
| 153 | close(C) |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | func (pool *PeerPool) peerDisconnected(peerIdx uint32) { |
| 158 | pool.lock.Lock() |