further Windoze support (test/io5.c works, gatling still doesn't)
This is just to get gatling to work, I may remove it again after that.master
parent
f65398ff2e
commit
c1c50c7dbd
@ -1,10 +1,33 @@
|
||||
#include <sys/types.h>
|
||||
#ifndef __MINGW32__
|
||||
#ifdef __MINGW32__
|
||||
#include "io_internal.h"
|
||||
#include <mswsock.h>
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#include "socket.h"
|
||||
#include "windoze.h"
|
||||
|
||||
int socket_listen(int s,unsigned int backlog) {
|
||||
return winsock2errno(listen(s, backlog));
|
||||
#ifdef __MINGW32__
|
||||
io_entry* e;
|
||||
int r = listen(s, backlog);
|
||||
if (r==-1) return winsock2errno(-1);
|
||||
e=array_get(&io_fds,sizeof(io_entry),s);
|
||||
if (e && e->inuse) {
|
||||
e->listened=1;
|
||||
if (e->wantread) {
|
||||
/* queue a non-blocking accept */
|
||||
DWORD received;
|
||||
e->next_accept=socket(AF_INET,SOCK_STREAM,0);
|
||||
if (e->next_accept!=-1) {
|
||||
AcceptEx(s,e->next_accept,e->inbuf,0,200,200,&received,&e->or);
|
||||
e->acceptqueued=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return r;
|
||||
#else
|
||||
return listen(s, backlog);
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue