Beispiel #1
0
//export cbioNew
func cbioNew(b *C.BIO) C.int {
	b.shutdown = 1
	b.init = 1
	b.num = -1
	b.ptr = nil
	b.flags = 0
	return 1
}
Beispiel #2
0
//export go_conn_bio_new
func go_conn_bio_new(bio *C.BIO) C.int {
	//we are initializing here
	bio.init = C.int(1)
	//see mem_new()
	bio.num = C.int(-1)
	bio.ptr = nil
	bio.flags = C.BIO_FLAGS_READ | C.BIO_FLAGS_WRITE
	return C.int(1)
}
Beispiel #3
0
//export go_conn_bio_free
func go_conn_bio_free(bio *C.BIO) C.int {
	var conn *Conn = (*Conn)(bio.ptr)
	conn.conn.Close()
	if C.int(bio.shutdown) != 0 {
		bio.ptr = nil
		bio.flags = 0
		bio.init = 0
	}
	return C.int(1)
}
Beispiel #4
0
func (self *writeBio) Disconnect(b *C.BIO) {
	if loadWritePtr(b) == self {
		b.ptr = nil
	}
}
Beispiel #5
0
func (self *readBio) Disconnect(b *C.BIO) {
	if loadReadPtr(b) == self {
		bufPool.Put(self.buf)
		b.ptr = nil
	}
}
Beispiel #6
0
func bioSetRetryRead(b *C.BIO) {
	// from BIO_set_retry_read and BIO_set_flags
	b.flags |= (C.BIO_FLAGS_READ | C.BIO_FLAGS_SHOULD_RETRY)
}
Beispiel #7
0
func bioClearRetryFlags(b *C.BIO) {
	// from BIO_clear_retry_flags and BIO_clear_flags
	b.flags &= ^(C.BIO_FLAGS_RWS | C.BIO_FLAGS_SHOULD_RETRY)
}
Beispiel #8
0
func (self *readBio) Disconnect(b *C.BIO) {
	if loadReadPtr(b) == self {
		b.ptr = nil
	}
}
Beispiel #9
0
func (self *readBio) Disconnect(b *C.BIO) {
	if loadReadPtr(b) == self {
		readBioMapping.Del(token(b.ptr))
		b.ptr = nil
	}
}
Beispiel #10
0
func (self *writeBio) Disconnect(b *C.BIO) {
	if loadWritePtr(b) == self {
		writeBioMapping.Del(token(b.ptr))
		b.ptr = nil
	}
}