mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-23 15:55:10 +01:00
Move to milliseconds in recv_timeout()
This commit is contained in:
parent
905dd2425c
commit
c8d8e97cbd
4 changed files with 21 additions and 12 deletions
|
|
@ -585,10 +585,10 @@ int net_recv( void *ctx, unsigned char *buf, size_t len )
|
|||
|
||||
#if defined(POLARSSL_HAVE_TIME)
|
||||
/*
|
||||
* Read at most 'len' characters, blocking for at most 'timeout' seconds
|
||||
* Read at most 'len' characters, blocking for at most 'timeout' ms
|
||||
*/
|
||||
int net_recv_timeout( void *ctx, unsigned char *buf, size_t len,
|
||||
unsigned char timeout )
|
||||
uint32_t timeout )
|
||||
{
|
||||
int ret;
|
||||
struct timeval tv;
|
||||
|
|
@ -598,8 +598,8 @@ int net_recv_timeout( void *ctx, unsigned char *buf, size_t len,
|
|||
FD_ZERO( &read_fds );
|
||||
FD_SET( fd, &read_fds );
|
||||
|
||||
tv.tv_sec = timeout;
|
||||
tv.tv_usec = 0;
|
||||
tv.tv_sec = timeout / 1000;
|
||||
tv.tv_usec = ( timeout % 1000 ) * 1000;
|
||||
|
||||
ret = select( fd + 1, &read_fds, NULL, NULL, &tv );
|
||||
|
||||
|
|
|
|||
|
|
@ -1990,7 +1990,7 @@ int ssl_fetch_input( ssl_context *ssl, size_t nb_want )
|
|||
ssl->handshake != NULL ) /* No timeout outside handshake */
|
||||
{
|
||||
ret = ssl->f_recv_timeout( ssl->p_bio, ssl->in_hdr, len,
|
||||
ssl->handshake->retransmit_timeout / 1000 );
|
||||
ssl->handshake->retransmit_timeout );
|
||||
}
|
||||
else
|
||||
ret = ssl->f_recv( ssl->p_bio, ssl->in_hdr, len );
|
||||
|
|
@ -4936,8 +4936,8 @@ void ssl_set_bio_timeout( ssl_context *ssl,
|
|||
void *p_bio,
|
||||
int (*f_send)(void *, const unsigned char *, size_t),
|
||||
int (*f_recv)(void *, unsigned char *, size_t),
|
||||
int (*f_recv_timeout)(void *, unsigned char *, size_t, unsigned char),
|
||||
unsigned char timeout )
|
||||
int (*f_recv_timeout)(void *, unsigned char *, size_t, uint32_t),
|
||||
uint32_t timeout )
|
||||
{
|
||||
ssl->p_bio = p_bio;
|
||||
ssl->f_send = f_send;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue