(local sockjs.Session)
| 284 | } |
| 285 | |
| 286 | func (k *PrivateKite) newTunnel(local sockjs.Session) *Tunnel { |
| 287 | t := &Tunnel{ |
| 288 | id: atomic.AddUint64(&k.seq, 1), |
| 289 | localConn: local, |
| 290 | startChan: make(chan bool), |
| 291 | closeChan: make(chan bool), |
| 292 | } |
| 293 | |
| 294 | // Add to map. |
| 295 | k.tunnels[t.id] = t |
| 296 | |
| 297 | // Delete from map on close. |
| 298 | go func() { |
| 299 | <-t.CloseNotify() |
| 300 | delete(k.tunnels, t.id) |
| 301 | }() |
| 302 | |
| 303 | return t |
| 304 | } |
no test coverage detected