Remove listen check

This commit is contained in:
Asim Aslam 2019-08-10 18:44:50 +01:00
parent 2c66e94045
commit 6dd3ea1853

View File

@ -128,6 +128,7 @@ func (t *tun) process() {
// send the message via the interface // send the message via the interface
t.RLock() t.RLock()
log.Debugf("Sending some shit %d links", len(t.links))
for _, link := range t.links { for _, link := range t.links {
log.Debugf("Sending %+v to %s", newMsg, link.Remote()) log.Debugf("Sending %+v to %s", newMsg, link.Remote())
link.Send(newMsg) link.Send(newMsg)
@ -172,21 +173,15 @@ func (t *tun) listen(link transport.Socket, listener bool) {
var exists bool var exists bool
log.Debugf("Received %+v from %s", msg, link.Remote()) log.Debugf("Received %+v from %s", msg, link.Remote())
// if its a local listener then we use that as the session id // get the socket based on the tunnel id and session
// e.g we're using a loopback connecting to ourselves // this could be something we dialed in which case
if listener { // we have a session for it otherwise its a listener
s, exists = t.getSocket(id, session)
if !exists {
// try get it based on just the tunnel id
// the assumption here is that a listener
// has no session but its set a listener session
s, exists = t.getSocket(id, "listener") s, exists = t.getSocket(id, "listener")
} else {
// get the socket based on the tunnel id and session
// this could be something we dialed in which case
// we have a session for it otherwise its a listener
s, exists = t.getSocket(id, session)
if !exists {
// try get it based on just the tunnel id
// the assumption here is that a listener
// has no session but its set a listener session
s, exists = t.getSocket(id, "listener")
}
} }
// no socket in existence // no socket in existence