int StreamPeerSSL bio_read BIO char buf int len if buf NULL len return

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
int StreamPeerSSL::bio_read( BIO *b, char *buf, int len ) {
if ( buf == NULL || len <= 0 ) return 0;
StreamPeerSSL * sp = (StreamPeerSSL*)b->ptr;
if (sp->base.is_null())
return 0;
BIO_clear_retry_flags( b );
Error err;
int ret=0;
if (sp->block) {
err = sp->base->get_data((const uint8_t*)buf,len);
if (err==OK)
ret=len;
} else {
err = sp->base->get_partial_data((const uint8_t*)buf,len,ret);
if (err==OK && ret!=len) {
BIO_set_retry_write( b );
}
}
return ret;
}