mirror of
https://gitea.invidious.io/iv-org/litespeed-quic.git
synced 2024-08-15 00:53:43 +00:00
fix bug in send_packets_one_by_one on windows platform when send multiple iovs
This commit is contained in:
parent
61e670e170
commit
65c5d50287
1 changed files with 23 additions and 5 deletions
|
@ -1548,7 +1548,7 @@ send_packets_one_by_one (const struct lsquic_out_spec *specs, unsigned count)
|
||||||
#else
|
#else
|
||||||
DWORD bytes;
|
DWORD bytes;
|
||||||
WSAMSG msg;
|
WSAMSG msg;
|
||||||
WSABUF wsaBuf;
|
LPWSABUF pWsaBuf = NULL;
|
||||||
#endif
|
#endif
|
||||||
union {
|
union {
|
||||||
/* cmsg(3) recommends union for proper alignment */
|
/* cmsg(3) recommends union for proper alignment */
|
||||||
|
@ -1595,6 +1595,14 @@ send_packets_one_by_one (const struct lsquic_out_spec *specs, unsigned count)
|
||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
prev_ancil_key = 0;
|
prev_ancil_key = 0;
|
||||||
|
#ifdef WIN32
|
||||||
|
#define MAX_OUT_BATCH_SIZE 1024
|
||||||
|
pWsaBuf = malloc(sizeof(*pWsaBuf)*MAX_OUT_BATCH_SIZE*2);
|
||||||
|
if (NULL == pWsaBuf) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
sport = specs[n].peer_ctx;
|
sport = specs[n].peer_ctx;
|
||||||
|
@ -1611,14 +1619,17 @@ send_packets_one_by_one (const struct lsquic_out_spec *specs, unsigned count)
|
||||||
msg.msg_iovlen = specs[n].iovlen;
|
msg.msg_iovlen = specs[n].iovlen;
|
||||||
msg.msg_flags = 0;
|
msg.msg_flags = 0;
|
||||||
#else
|
#else
|
||||||
wsaBuf.buf = specs[n].iov->iov_base;
|
for (int i = 0; i < specs[n].iovlen; i++)
|
||||||
wsaBuf.len = specs[n].iov->iov_len;
|
{
|
||||||
|
pWsaBuf[i].buf = specs[n].iov[i].iov_base;
|
||||||
|
pWsaBuf[i].len = specs[n].iov[i].iov_len;
|
||||||
|
}
|
||||||
msg.name = (void *) specs[n].dest_sa;
|
msg.name = (void *) specs[n].dest_sa;
|
||||||
msg.namelen = (AF_INET == specs[n].dest_sa->sa_family ?
|
msg.namelen = (AF_INET == specs[n].dest_sa->sa_family ?
|
||||||
sizeof(struct sockaddr_in) :
|
sizeof(struct sockaddr_in) :
|
||||||
sizeof(struct sockaddr_in6));
|
sizeof(struct sockaddr_in6));
|
||||||
msg.dwBufferCount = 1;
|
msg.dwBufferCount = specs[n].iovlen;
|
||||||
msg.lpBuffers = &wsaBuf;
|
msg.lpBuffers = pWsaBuf;
|
||||||
msg.dwFlags = 0;
|
msg.dwFlags = 0;
|
||||||
#endif
|
#endif
|
||||||
if ((sport->sp_flags & SPORT_SERVER) && specs[n].local_sa->sa_family)
|
if ((sport->sp_flags & SPORT_SERVER) && specs[n].local_sa->sa_family)
|
||||||
|
@ -1681,6 +1692,13 @@ send_packets_one_by_one (const struct lsquic_out_spec *specs, unsigned count)
|
||||||
if (n < orig_count)
|
if (n < orig_count)
|
||||||
prog_sport_cant_send(sport->sp_prog, sport->fd);
|
prog_sport_cant_send(sport->sp_prog, sport->fd);
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
if (NULL != pWsaBuf) {
|
||||||
|
free(pWsaBuf);
|
||||||
|
pWsaBuf = NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
{
|
{
|
||||||
if (n < orig_count && out_limit)
|
if (n < orig_count && out_limit)
|
||||||
|
|
Loading…
Reference in a new issue