work on dtls
FossilOrigin-Name: 8b02ed99e3287eaa044a4f4c6c8b61ab6f1a14983db99accb43b5be8425befe8
This commit is contained in:
20
src/cw/conn_q_wait_packet.c
Normal file
20
src/cw/conn_q_wait_packet.c
Normal file
@ -0,0 +1,20 @@
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "conn.h"
|
||||
|
||||
int conn_q_wait_packet(struct conn * conn, int seconds)
|
||||
{
|
||||
|
||||
struct timespec timespec;
|
||||
clock_gettime(CLOCK_REALTIME,×pec);
|
||||
timespec.tv_sec+=seconds;
|
||||
|
||||
|
||||
/* wait one second to get a packet */
|
||||
if (sem_timedwait(&conn->q_sem,×pec)==-1){
|
||||
return EAGAIN;
|
||||
};
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user