Exemplo n.º 1
0
//UtpInit initializes and returnsinstance
func UtpInit(version int) *UtpContext {
	ctx := C.utp_init(C.int(version))
	ss := make(map[*C.utp_socket]*UtpSocket, 0)

	utpContext := &UtpContext{ctx: ctx, sockets: ss}
	contexts[ctx] = utpContext
	return utpContext
}
Exemplo n.º 2
0
func NewUTPContext() *UTPContext {
	return &UTPContext{
		raw:  C.utp_init(C.int(UTP_VERSION)),
		lock: sync.Mutex{},
	}
}