mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Revert recvmmsg
This commit is contained in:
parent
409abf1b90
commit
5d8d900643
|
@ -1497,13 +1497,12 @@ int net_udp_send(NETSOCKET sock, const NETADDR *addr, const void *data, int size
|
||||||
void net_init_mmsgs(MMSGS* m)
|
void net_init_mmsgs(MMSGS* m)
|
||||||
{
|
{
|
||||||
#if defined(CONF_PLATFORM_LINUX)
|
#if defined(CONF_PLATFORM_LINUX)
|
||||||
int i;
|
|
||||||
m->pos = 0;
|
m->pos = 0;
|
||||||
m->size = 0;
|
m->size = 0;
|
||||||
mem_zero(m->msgs, sizeof(m->msgs));
|
mem_zero(m->msgs, sizeof(m->msgs));
|
||||||
mem_zero(m->iovecs, sizeof(m->iovecs));
|
mem_zero(m->iovecs, sizeof(m->iovecs));
|
||||||
mem_zero(m->sockaddrs, sizeof(m->sockaddrs));
|
mem_zero(m->sockaddrs, sizeof(m->sockaddrs));
|
||||||
for(i = 0; i < VLEN; ++i)
|
for(int i = 0; i < VLEN; ++i)
|
||||||
{
|
{
|
||||||
m->iovecs[i].iov_base = m->bufs[i];
|
m->iovecs[i].iov_base = m->bufs[i];
|
||||||
m->iovecs[i].iov_len = PACKETSIZE;
|
m->iovecs[i].iov_len = PACKETSIZE;
|
||||||
|
|
|
@ -745,8 +745,8 @@ int net_udp_send(NETSOCKET sock, const NETADDR *addr, const void *data, int size
|
||||||
#define PACKETSIZE 1400
|
#define PACKETSIZE 1400
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int pos;
|
|
||||||
#ifdef CONF_PLATFORM_LINUX
|
#ifdef CONF_PLATFORM_LINUX
|
||||||
|
int pos;
|
||||||
int size;
|
int size;
|
||||||
struct mmsghdr msgs[VLEN];
|
struct mmsghdr msgs[VLEN];
|
||||||
struct iovec iovecs[VLEN];
|
struct iovec iovecs[VLEN];
|
||||||
|
|
|
@ -61,16 +61,13 @@ void Run(unsigned short Port, NETADDR Dest)
|
||||||
dbg_msg("crapnet", "cfg = %d", n);
|
dbg_msg("crapnet", "cfg = %d", n);
|
||||||
Lastcfg = n;
|
Lastcfg = n;
|
||||||
|
|
||||||
MMSGS m;
|
|
||||||
net_init_mmsgs(&m);
|
|
||||||
|
|
||||||
// handle incoming packets
|
// handle incoming packets
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
// fetch data
|
// fetch data
|
||||||
int DataTrash = 0;
|
int DataTrash = 0;
|
||||||
NETADDR From;
|
NETADDR From;
|
||||||
int Bytes = net_udp_recv(Socket, &From, aBuffer, 1024*2, &m);
|
int Bytes = net_udp_recv(Socket, &From, aBuffer, 1024*2);
|
||||||
if(Bytes <= 0)
|
if(Bytes <= 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue