in main.go [143:231]
func GoVNCDriver_VNCSession_connect(self, args, kwds *C.PyObject) *C.PyObject {
batchLock.Lock()
defer batchLock.Unlock()
// Just store this as a property on self?
ptr := uintptr(unsafe.Pointer(self))
info, ok := batchMgr[ptr]
if !ok {
setError(errors.New("VNCSession is already closed"))
return nil
}
_ = info
nameC := new(*C.char)
addressC := new(*C.char)
passwordC := new(*C.char)
encodingC := new(*C.char)
qualityLevelC := new(C.int)
compressLevelC := new(C.int)
fineQualityLevelC := new(C.int)
subsampleLevelC := new(C.int)
startTimeoutC := new(C.ulong)
subscriptionPy := new(*C.PyObject)
*compressLevelC = C.int(-1)
*qualityLevelC = C.int(-1)
*fineQualityLevelC = C.int(-1)
*subsampleLevelC = C.int(-1)
if C.PyArg_ParseTuple_connect(args, kwds, nameC, addressC, passwordC, encodingC, qualityLevelC, compressLevelC, fineQualityLevelC, subsampleLevelC, startTimeoutC, subscriptionPy) == 0 {
return nil
}
name := C.GoString(*nameC)
address := C.GoString(*addressC)
password := C.GoString(*passwordC)
encoding := C.GoString(*encodingC)
qualityLevel := int(*qualityLevelC)
compressLevel := int(*compressLevelC)
fineQualityLevel := int(*fineQualityLevelC)
subsampleLevel := int(*subsampleLevelC)
startTimeout := int(*startTimeoutC)
subscription, ok := convertSubscriptionPy(*subscriptionPy)
if !ok {
return nil
}
if _, ok := info.names[name]; ok {
log.Infof("disconnecting existing connection %s", name)
info.close(name)
}
if password == "" {
// our default password!
password = "openai"
}
err := info.batch.Open(name, gymvnc.VNCSessionConfig{
Address: address,
Password: password,
Encoding: encoding,
QualityLevel: qualityLevel,
CompressLevel: compressLevel,
FineQualityLevel: fineQualityLevel,
SubsampleLevel: subsampleLevel,
StartTimeout: time.Duration(startTimeout) * time.Second,
Subscription: subscription,
})
if err != nil {
setError(err)
return nil
}
info.open(name)
// errCh := make(chan error, 10)
// done := make(chan bool)
// batch, err := gymvnc.NewVNCSession(, )
// if err != nil {
// close(done)
// setError(err)
// return C.int(-1)
// }
C.go_vncdriver_incref(Py_None)
return Py_None
}