add include files for UDP SEGMENT
@@ -65,6 +65,7 @@ int picoquic_packet_loop_gso(picoquic_quic_t* quic,
#include <errno.h>
#include <netdb.h>
#include <netinet/in.h>
+#include <netinet/udp.h>
#include <sys/select.h>
#ifndef SOCKET_TYPE
@@ -86,6 +87,19 @@ int picoquic_packet_loop_gso(picoquic_quic_t* quic,
#include "picoquic_packet_loop.h"
#include "picoquic_unified_log.h"
+#ifdef UDP_SEGMENT
+static int udp_gso_available = 1;
+#else
+static int udp_gso_available = 0;
+#endif
+
+#ifdef UDP_GRO
+static int udp_gro_available = 1;
+#else
+static int udp_gro_available = 0;
+#endif
+
+
int picoquic_packet_loop_open_sockets(int local_port, int local_af, SOCKET_TYPE* s_socket, int* sock_af, int nb_sockets_max)
{
int nb_sockets = (local_af == AF_UNSPEC) ? 2 : 1;
@@ -144,7 +158,12 @@ int picoquic_packet_loop_gso(picoquic_quic_t* quic,
struct sockaddr_storage addr_to;
int if_index_to;
uint8_t buffer[1536];
- uint8_t send_buffer[1536];
+ uint8_t * send_buffer;
+#ifdef UDP_SEGMENT
+ size_t send_buffer_size = 0x10000;
+#else
+ size_t send_buffer_size = 1536;
+#endif
size_t send_length = 0;
int bytes_recv;
uint64_t loop_count_time = current_time;
@@ -170,6 +189,13 @@ int picoquic_packet_loop_gso(picoquic_quic_t* quic,
ret = loop_callback(quic, picoquic_packet_loop_ready, loop_callback_ctx);
}
+ if (ret == 0){
+ send_buffer = malloc(send_buffer_size);
+ if (send_buffer == NULL){
+ ret = -1;
+ }
+ }
+
/* Wait for packets */
/* TODO: add stopping condition, was && (!just_once || !connection_done) */
while (ret == 0) {
@@ -379,6 +405,10 @@ int picoquic_packet_loop_gso(picoquic_quic_t* quic,
}
}
+ if (send_buffer != NULL){
+ free(send_buffer);
+ }
+
return ret;
}
