mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-10-12 01:26:48 +08:00
avoid calling gnutls_record_get_discarded() when a DTLS session isn't available
This commit is contained in:
+10
-11
@@ -1071,20 +1071,19 @@ static int dtls_mainloop(worker_st * ws, struct timespec *tnow)
|
||||
{
|
||||
int ret, l;
|
||||
|
||||
#if GNUTLS_VERSION_NUMBER <= 0x030210
|
||||
/* work-around an infinite loop caused by gnutls_record_recv()
|
||||
* always succeeding by counting every error as a discarded packet.
|
||||
*/
|
||||
ret = gnutls_record_get_discarded(ws->dtls_session);
|
||||
if (ret > 1000) {
|
||||
ws->udp_state = UP_DISABLED;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
switch (ws->udp_state) {
|
||||
case UP_ACTIVE:
|
||||
case UP_INACTIVE:
|
||||
|
||||
#if GNUTLS_VERSION_NUMBER <= 0x030210
|
||||
/* work-around an infinite loop caused by gnutls_record_recv()
|
||||
* always succeeding by counting every error as a discarded packet.
|
||||
*/
|
||||
ret = gnutls_record_get_discarded(ws->dtls_session);
|
||||
if (ret > 1000) {
|
||||
ws->udp_state = UP_DISABLED;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
ret =
|
||||
tls_recv_nb(ws->dtls_session, ws->buffer, ws->buffer_size);
|
||||
oclog(ws, LOG_TRANSFER_DEBUG,
|
||||
|
||||
Reference in New Issue
Block a user