From: Andrew Dinh Date: Thu, 17 Oct 2024 19:48:17 +0000 (-0700) Subject: Remove extra FD_SET X-Git-Tag: openssl-3.5.0-alpha1~330 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=417a8e8812e99420218e899ba06fe96ee7721f5f;p=thirdparty%2Fopenssl.git Remove extra FD_SET Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/25532) --- diff --git a/demos/guide/quic-server-non-block.c b/demos/guide/quic-server-non-block.c index b01fb7d9e3a..44dc228408a 100644 --- a/demos/guide/quic-server-non-block.c +++ b/demos/guide/quic-server-non-block.c @@ -228,10 +228,6 @@ static void wait_for_activity(SSL *ssl) if (SSL_net_read_desired(ssl)) FD_SET(sock, &read_fd); - /* Add the socket file descriptor to the fd_set */ - FD_SET(sock, &read_fd); - FD_SET(sock, &write_fd); - /* * Find out when OpenSSL would next like to be called, regardless of * whether the state of the underlying socket has changed or not. diff --git a/doc/man7/ossl-guide-quic-server-non-block.pod b/doc/man7/ossl-guide-quic-server-non-block.pod index 886491384fd..c7d4a695a90 100644 --- a/doc/man7/ossl-guide-quic-server-non-block.pod +++ b/doc/man7/ossl-guide-quic-server-non-block.pod @@ -32,7 +32,7 @@ text that will be echoed back by the server. Both the listening socket and connected socket are "nonblocking". However, we use select() to make the listening socket block when it cannot read/write. Rather than stopping and waiting, your application may need to go and do other -tasks whilst the B object is unable to read/write. For example: updating a +tasks whilst the B object is unable to read/write. For example: updating a GUI or performing operations on some other connection or stream. The complete source code for this example nonblocking QUIC server is available @@ -44,12 +44,12 @@ We assume that you already have OpenSSL installed on your system; that you already have some fundamental understanding of OpenSSL concepts and QUIC (see L and L); and that you know how to write and build C code and link it against the -libcrypto and libssl libraries that are provided by OpenSSL. It also assumes +libcrypto and libssl libraries that are provided by OpenSSL. It also assumes that you have a basic understanding of UDP/IP and sockets. =head2 Creating the SSL_CTX and SSL objects -The first step is to create an B object for our server. We use the +The first step is to create an B object for our server. We use the L function for this purpose. We pass as an argument the return value of the function L. You should use this method whenever you are writing a QUIC server. @@ -255,10 +255,6 @@ a more real-world application would likely use this time to perform other tasks. if (SSL_net_read_desired(ssl)) FD_SET(sock, &read_fd); - /* Add the socket file descriptor to the fd_set */ - FD_SET(sock, &read_fd); - FD_SET(sock, &write_fd); - /* * Find out when OpenSSL would next like to be called, regardless of * whether the state of the underlying socket has changed or not. @@ -313,7 +309,7 @@ With the handshake complete, the server reads all the client input. } } -Finally, we echo the received data back to the client. We can use +Finally, we echo the received data back to the client. We can use L to pass in a special flag SSL_WRITE_FLAG_CONCLUDE that will send a FIN packet once the write has successfully finished writing all the data to the peer.