<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>
GitLab
</title>


<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">
<div>
<p dir="auto">Not using virt-time.h, just using a custom pull_timeout function (replaces select()). WDYT ?</p>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">diff --git a/tests/handshake-timeout.c b/tests/handshake-timeout.c</span>
<span id="LC2" class="line" lang="plaintext">index 52c21f69b4..5e8afe3564 100644</span>
<span id="LC3" class="line" lang="plaintext">--- a/tests/handshake-timeout.c</span>
<span id="LC4" class="line" lang="plaintext">+++ b/tests/handshake-timeout.c</span>
<span id="LC5" class="line" lang="plaintext">@@ -61,6 +61,14 @@ static void client_log_func(int level, const char *str)</span>
<span id="LC6" class="line" lang="plaintext">        fprintf(stderr, "client|<%d>| %s", level, str);</span>
<span id="LC7" class="line" lang="plaintext"> }</span>
<span id="LC8" class="line" lang="plaintext"> </span>
<span id="LC9" class="line" lang="plaintext">+static int pull_timeout_func(gnutls_transport_ptr_t fd, unsigned int ms)</span>
<span id="LC10" class="line" lang="plaintext">+{</span>
<span id="LC11" class="line" lang="plaintext">+       (void)fd;</span>
<span id="LC12" class="line" lang="plaintext">+       (void)ms;</span>
<span id="LC13" class="line" lang="plaintext">+</span>
<span id="LC14" class="line" lang="plaintext">+       return 0;</span>
<span id="LC15" class="line" lang="plaintext">+}</span>
<span id="LC16" class="line" lang="plaintext">+</span>
<span id="LC17" class="line" lang="plaintext"> static void client(int fd, int wait)</span>
<span id="LC18" class="line" lang="plaintext"> {</span>
<span id="LC19" class="line" lang="plaintext">        int ret;</span>
<span id="LC20" class="line" lang="plaintext">@@ -90,6 +98,9 @@ static void client(int fd, int wait)</span>
<span id="LC21" class="line" lang="plaintext"> </span>
<span id="LC22" class="line" lang="plaintext">        gnutls_transport_set_int(session, fd);</span>
<span id="LC23" class="line" lang="plaintext"> </span>
<span id="LC24" class="line" lang="plaintext">+       if (wait)</span>
<span id="LC25" class="line" lang="plaintext">+               gnutls_transport_set_pull_timeout_function(session, pull_timeout_func);</span>
<span id="LC26" class="line" lang="plaintext">+</span>
<span id="LC27" class="line" lang="plaintext">        /* Perform the TLS handshake</span>
<span id="LC28" class="line" lang="plaintext">         */</span>
<span id="LC29" class="line" lang="plaintext">        do {</span>
<span id="LC30" class="line" lang="plaintext">@@ -151,7 +162,7 @@ static void server(int fd, int wait)</span>
<span id="LC31" class="line" lang="plaintext">        gnutls_transport_set_int(session, fd);</span>
<span id="LC32" class="line" lang="plaintext"> </span>
<span id="LC33" class="line" lang="plaintext">        if (wait) {</span>
<span id="LC34" class="line" lang="plaintext">-               sec_sleep(25);</span>
<span id="LC35" class="line" lang="plaintext">+               sleep(1);</span>
<span id="LC36" class="line" lang="plaintext">        } else {</span>
<span id="LC37" class="line" lang="plaintext">                do {</span>
<span id="LC38" class="line" lang="plaintext">                        ret = gnutls_handshake(session);</span></code></pre>
</div>


</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #777777;">

<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/issues/636#note_121671514">view it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can
<a href="https://gitlab.com/sent_notifications/5f43c21c081a1fb0d20d78e40e372a77/unsubscribe">unsubscribe</a>
from this thread or
adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Issue","url":"https://gitlab.com/gnutls/gnutls/issues/636#note_121671514"}}</script>
</p>
</div>
</body>
</html>