BOOL transport_bio_buffered_drain(BIO *bio) { int status; rdpTcp* tcp = (rdpTcp*) bio->ptr; if (!ringbuffer_used(&tcp->xmitBuffer)) return 1; status = transport_bio_buffered_write(bio, NULL, 0); return status >= 0; }
static long transport_bio_buffered_ctrl(BIO* bio, int cmd, long arg1, void* arg2) { int status = -1; WINPR_BIO_BUFFERED_SOCKET* ptr = (WINPR_BIO_BUFFERED_SOCKET*) BIO_get_data(bio); switch (cmd) { case BIO_CTRL_FLUSH: if (!ringbuffer_used(&ptr->xmitBuffer)) status = 1; else status = (transport_bio_buffered_write(bio, NULL, 0) >= 0) ? 1 : -1; break; case BIO_CTRL_WPENDING: status = ringbuffer_used(&ptr->xmitBuffer); break; case BIO_CTRL_PENDING: status = 0; break; case BIO_C_READ_BLOCKED: status = (int) ptr->readBlocked; break; case BIO_C_WRITE_BLOCKED: status = (int) ptr->writeBlocked; break; default: status = BIO_ctrl(BIO_next(bio), cmd, arg1, arg2); break; } return status; }