mirror of
https://github.com/janet-lang/janet
synced 2025-01-28 08:04:45 +00:00
Try again for windows build.
This commit is contained in:
parent
7d0b1955a2
commit
d50c4ef6da
@ -1332,8 +1332,8 @@ JanetAsyncStatus ev_machine_read(JanetListenerState *s, JanetAsyncEvent event) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return JANET_ASYNC_STATUS_NOT_DONE;
|
return JANET_ASYNC_STATUS_NOT_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void janet_ev_read_generic(JanetStream *stream, JanetBuffer *buf, int32_t nbytes, int is_chunked, JanetReadMode mode, int flags) {
|
static void janet_ev_read_generic(JanetStream *stream, JanetBuffer *buf, int32_t nbytes, int is_chunked, JanetReadMode mode, int flags) {
|
||||||
@ -1431,7 +1431,7 @@ JanetAsyncStatus ev_machine_write(JanetListenerState *s, JanetAsyncEvent event)
|
|||||||
break;
|
break;
|
||||||
case JANET_ASYNC_EVENT_USER: {
|
case JANET_ASYNC_EVENT_USER: {
|
||||||
/* Begin write */
|
/* Begin write */
|
||||||
int32_t start, len;
|
int32_t len;
|
||||||
const uint8_t *bytes;
|
const uint8_t *bytes;
|
||||||
if (state->is_buffer) {
|
if (state->is_buffer) {
|
||||||
/* If buffer, convert to string. */
|
/* If buffer, convert to string. */
|
||||||
@ -1555,7 +1555,7 @@ static void janet_ev_write_generic(JanetStream *stream, void *buf, void *dest_ab
|
|||||||
state->mode = mode;
|
state->mode = mode;
|
||||||
#ifdef JANET_WINDOWS
|
#ifdef JANET_WINDOWS
|
||||||
state->flags = (DWORD) flags;
|
state->flags = (DWORD) flags;
|
||||||
net_machine_write((JanetListenerState *) state, JANET_ASYNC_EVENT_USER);
|
ev_machine_write((JanetListenerState *) state, JANET_ASYNC_EVENT_USER);
|
||||||
#else
|
#else
|
||||||
state->start = 0;
|
state->start = 0;
|
||||||
state->flags = flags;
|
state->flags = flags;
|
||||||
|
@ -57,6 +57,7 @@ const JanetAbstractType janet_address_type = {
|
|||||||
|
|
||||||
#ifdef JANET_WINDOWS
|
#ifdef JANET_WINDOWS
|
||||||
#define JSOCKCLOSE(x) closesocket((SOCKET) x)
|
#define JSOCKCLOSE(x) closesocket((SOCKET) x)
|
||||||
|
#define JSOCKDEFAULT INVALID_SOCKET
|
||||||
#define JSOCKVALID(x) ((x) != INVALID_SOCKET)
|
#define JSOCKVALID(x) ((x) != INVALID_SOCKET)
|
||||||
#define JSock SOCKET
|
#define JSock SOCKET
|
||||||
#define JSOCKFLAGS 0
|
#define JSOCKFLAGS 0
|
||||||
@ -72,7 +73,7 @@ const JanetAbstractType janet_address_type = {
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static JanetStream *make_stream(JanetHandle handle, uint32_t flags);
|
static JanetStream *make_stream(JSock handle, uint32_t flags);
|
||||||
|
|
||||||
/* We pass this flag to all send calls to prevent sigpipe */
|
/* We pass this flag to all send calls to prevent sigpipe */
|
||||||
#ifndef MSG_NOSIGNAL
|
#ifndef MSG_NOSIGNAL
|
||||||
@ -172,7 +173,7 @@ static int net_sched_accept_impl(NetStateAccept *state, Janet *err) {
|
|||||||
SOCKET lsock = (SOCKET) state->lstream->handle;
|
SOCKET lsock = (SOCKET) state->lstream->handle;
|
||||||
SOCKET asock = WSASocketW(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, WSA_FLAG_OVERLAPPED);
|
SOCKET asock = WSASocketW(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, WSA_FLAG_OVERLAPPED);
|
||||||
if (asock == INVALID_SOCKET) {
|
if (asock == INVALID_SOCKET) {
|
||||||
*err = net_lasterr();
|
*err = ev_lasterr();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
JanetStream *astream = make_stream(asock, JANET_STREAM_READABLE | JANET_STREAM_WRITABLE);
|
JanetStream *astream = make_stream(asock, JANET_STREAM_READABLE | JANET_STREAM_WRITABLE);
|
||||||
@ -181,7 +182,7 @@ static int net_sched_accept_impl(NetStateAccept *state, Janet *err) {
|
|||||||
if (FALSE == AcceptEx(lsock, asock, state->buf, 0, socksize, socksize, NULL, &state->overlapped)) {
|
if (FALSE == AcceptEx(lsock, asock, state->buf, 0, socksize, socksize, NULL, &state->overlapped)) {
|
||||||
int code = WSAGetLastError();
|
int code = WSAGetLastError();
|
||||||
if (code == WSA_IO_PENDING) return 0; /* indicates io is happening async */
|
if (code == WSA_IO_PENDING) return 0; /* indicates io is happening async */
|
||||||
*err = net_lasterr();
|
*err = ev_lasterr();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -614,8 +615,8 @@ static const JanetMethod net_stream_methods[] = {
|
|||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
static JanetStream *make_stream(JanetHandle handle, uint32_t flags) {
|
static JanetStream *make_stream(JSock handle, uint32_t flags) {
|
||||||
return janet_stream(handle, flags | JANET_STREAM_SOCKET, net_stream_methods);
|
return janet_stream((JanetHandle) handle, flags | JANET_STREAM_SOCKET, net_stream_methods);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const JanetReg net_cfuns[] = {
|
static const JanetReg net_cfuns[] = {
|
||||||
|
Loading…
Reference in New Issue
Block a user