telebit/rvpn/connection/connection_registration.go
Henry Camacho ff3e63da8d Correcting Critical Bug
- when testing streams to WSS client, I caused tunnel.js to abort in xfer.
- this caused a panic in go.
- found that connection was reaped and garbage collected during send routines.
- placed synchronize around a connection states.
- moved connection creation into connection table.
- allowed connections to hang around while in a false state…
- will have a go routine remove them after some idle time and connections being false.
2017-02-19 14:05:06 -06:00

36 lines
891 B
Go

package connection
import "github.com/gorilla/websocket"
//Registration -- A connection registration structure used to bring up a connection
//connection table will then handle additing and sdtarting up the various readers
//else error.
type Registration struct {
// The websocket connection.
conn *websocket.Conn
// Address of the Remote End Point
source string
// communications channel between go routines
commCh chan bool
//initialDomains - a list of domains from the JWT
initialDomains []interface{}
}
//NewRegistration -- Constructor
func NewRegistration(conn *websocket.Conn, remoteAddress string, initialDomains []interface{}) (p *Registration) {
p = new(Registration)
p.conn = conn
p.source = remoteAddress
p.commCh = make(chan bool)
p.initialDomains = initialDomains
return
}
//CommCh -- Property
func (c *Registration) CommCh() chan bool {
return c.commCh
}