retrieveBinding gets the latest tunnel for a key.
(k tKey)
| 394 | |
| 395 | // retrieveBinding gets the latest tunnel for a key. |
| 396 | func (t *tunneler) retrieve(k tKey) tunnel { |
| 397 | t.mu.Lock() |
| 398 | defer t.mu.Unlock() |
| 399 | dstMap, ok := t.latest[k.src] |
| 400 | if !ok { |
| 401 | return tunnel{ |
| 402 | tKey: k, |
| 403 | active: false, |
| 404 | } |
| 405 | } |
| 406 | |
| 407 | tun, ok := dstMap[k.dst] |
| 408 | if !ok { |
| 409 | return tunnel{ |
| 410 | tKey: k, |
| 411 | active: false, |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | return tun |
| 416 | } |
| 417 | |
| 418 | func (t *tunneler) writeOne(tun tunnel) error { |
| 419 | var err error |