<html><head></head><body><div style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div></div>
            <div>Hi,</div><div><br></div><div><br></div><div>I am new in OpenSSL. </div><div><br></div><div>I was confused with 1.0.2 implementation where <span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;">SSL_accept </span>is called inside the DTLSv1_Listen method. But in 1.1.0, SSL_accept must be called after <span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;">DTLSv1_Listen in listener thread otherwise async socket will not be reset and epoll will always return data ready. </span></div><div><span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;">Now things are working.</span></div><div><span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;"><br></span></div><div><span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;">But I do not know, whether <span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;">DTLSv1_Listen/<span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;"> <span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;">SSL_accept in the listener thread </span>is capable to deal with thousands concurrent <span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;">connection establishment. Is there known limitation around it? </span></span></span></span></div><div><span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;"><span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;"><span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;"><span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;"><br></span></span></span></span></div><div>An alternative way, Call recvfrom from listener thread, pass the buffer and peer remote addresses to service thread, make new SSL object and Mem BIO and call <span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;"> </span><span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;">DTLSv1_Listen/</span><span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;"> SSL_accept methods. Later use, Mem BIO and recvfrom and sendto calls for data exchange.</span></div><div><span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;"><br></span></div><div><br></div><div>Could you please help me decide the better way?</div><div><span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;"><br></span></div><div><span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;"><br></span></div><div><span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;"><br></span></div><div><span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;">Regards,</span></div><div><span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;">Anand Choubey</span></div><div><span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;"><br></span></div><div><span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;"><br></span></div><div><br></div>
            
            <div id="ydp9db758e3yahoo_quoted_2659492892" class="ydp9db758e3yahoo_quoted">
                <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                    
                    <div>On Monday, November 27, 2017, 8:21:46 PM GMT+5:30, Anand Choubey via openssl-users <openssl-users@openssl.org> wrote:</div>
                    <div><br></div>
                    <div><br></div>
                    <div><div id="ydp9db758e3yiv7969453325"><div><div style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div>Hi,</div><div><br></div><div>OpenSSL version is 1.1.0e.</div><div><br></div><div>I am writing high-performance DTLS server which can accept thousands of connections concurrently.  </div><div><br></div><div>Originally, I decided, DTLSv1_listen would be called inside the listener thread, once <span style="color:rgb(0, 0, 0);">DTLSv1_listen returns 1 i.e. successful, a new async socket will be created, it will be bound (using bind) and connected (using BIO_connect) with <span style="color:rgb(0, 0, 0);">DTLSv1_listen returned address. </span></span></div><div><span style="color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);">This new socket will be passed to service thread, BIO_set_fd will set this fd and SSL_accept will be called from service thread to complete the remaining handshake and data exchange etc.</span></span></div><div><span style="color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);"><br></span></span></div><div><span style="color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);">But behavior is not same as above, I have to call <span style="color:rgb(0, 0, 0);">SSL_accept  after bind and connect inside the listen, where DTLS handshake is completed. If SSL_accept is not called then <span style="color:rgb(0, 0, 0);">DTLSv1_listen is continuously called and always return 1 in listener thread. </span></span></span></span></div><div><span style="color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);"><br></span></span></span></span></div><div><span style="color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);">Could you please guide to resolve this issue or how to write multi-threaded dtls server where connection acceptance can be done inside the listener thread using <span style="color:rgb(0, 0, 0);">DTLSv1_listen?</span></span></span></span></span></div><div><span style="color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);"><br></span></span></span></span></span></div><div><span style="color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);">Thanks in Advance,</span></span></span></span></span></div><div><span style="color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);">Anand</span></span></span></span></span></div><div><span style="color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);"><br></span></span></div></div></div></div>-- <br>openssl-users mailing list<br>To unsubscribe: <a href="https://mta.openssl.org/mailman/listinfo/openssl-users" rel="nofollow" target="_blank">https://mta.openssl.org/mailman/listinfo/openssl-users</a><br></div>
                </div>
            </div></div></body></html>