Allows picoquic_select to read from regular file descriptors
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/stat.h>
#include "picosocks.h"
#include "util.h"
@@ -616,9 +617,15 @@ int picoquic_select(SOCKET_TYPE* sockets,
} else if (ret_select > 0) {
for (int i = 0; i < nb_sockets; i++) {
if (FD_ISSET(sockets[i], &readfds)) {
+ struct stat statbuf;
+ fstat(sockets[i], &statbuf);
+ if (S_ISSOCK(statbuf.st_mode)) {
bytes_recv = picoquic_recvmsg(sockets[i], addr_from, from_length,
addr_dest, dest_length, dest_if,
buffer, buffer_max);
+ } else {
+ bytes_recv = (int) read(sockets[i], buffer, (size_t) buffer_max);
+ }
// bytes_recv = recvfrom(socket[i], buffer, buffer_max, 0, addr_from, from_length);
if (bytes_recv <= 0) {
