func (self *SSL) Write(b []byte) (int, error) { length := len(b) ret := C.SSL_write(self.SSL, unsafe.Pointer(&b[0]), C.int(length)) if err := self.getError(ret); err != nil { return 0, err } return int(ret), nil }
func (c *Conn) write(b []byte) (int, func() error) { if len(b) == 0 { return 0, nil } c.mtx.Lock() defer c.mtx.Unlock() if c.is_shutdown { err := errors.New("connection closed") return 0, func() error { return err } } runtime.LockOSThread() defer runtime.UnlockOSThread() rv, errno := C.SSL_write(c.ssl, unsafe.Pointer(&b[0]), C.int(len(b))) if rv > 0 { return int(rv), nil } return 0, c.getErrorHandler(rv, errno) }
func (self *SSL) Write(b []byte) (int, error) { length := len(b) ret := C.SSL_write(self.SSL, unsafe.Pointer(&b[0]), C.int(length)) return length, self.getError(ret) }