mirror of
https://github.com/janet-lang/janet
synced 2025-02-18 01:30:02 +00:00
Fix some windows issues.
This commit is contained in:
parent
12f09ad2d7
commit
16cf7681f0
@ -288,7 +288,7 @@ JanetStream *janet_stream(JanetHandle handle, uint32_t flags, const JanetMethod
|
|||||||
if (flags & JANET_STREAM_SOCKET) {
|
if (flags & JANET_STREAM_SOCKET) {
|
||||||
#ifdef JANET_WINDOWS
|
#ifdef JANET_WINDOWS
|
||||||
u_long iMode = 0;
|
u_long iMode = 0;
|
||||||
ioctlsocket(handle, FIONBIO, &iMode);
|
ioctlsocket((SOCKET) handle, FIONBIO, &iMode);
|
||||||
#else
|
#else
|
||||||
#if !defined(SOCK_CLOEXEC) && defined(O_CLOEXEC)
|
#if !defined(SOCK_CLOEXEC) && defined(O_CLOEXEC)
|
||||||
int extra = O_CLOEXEC;
|
int extra = O_CLOEXEC;
|
||||||
@ -785,7 +785,7 @@ void janet_ev_deinit(void) {
|
|||||||
JanetListenerState *janet_listen(JanetStream *stream, JanetListener behavior, int mask, size_t size, void *user) {
|
JanetListenerState *janet_listen(JanetStream *stream, JanetListener behavior, int mask, size_t size, void *user) {
|
||||||
/* Add the handle to the io completion port if not already added */
|
/* Add the handle to the io completion port if not already added */
|
||||||
JanetListenerState *state = janet_listen_impl(stream, behavior, mask, size, user);
|
JanetListenerState *state = janet_listen_impl(stream, behavior, mask, size, user);
|
||||||
if (!(stream->flags & JANET_POLL_FLAG_IOCP)) {
|
if (!(stream->flags & JANET_STREAM_IOCP)) {
|
||||||
if (NULL == CreateIoCompletionPort(stream->handle, janet_vm_iocp, (ULONG_PTR) stream, 0)) {
|
if (NULL == CreateIoCompletionPort(stream->handle, janet_vm_iocp, (ULONG_PTR) stream, 0)) {
|
||||||
janet_panic("failed to listen for events");
|
janet_panic("failed to listen for events");
|
||||||
}
|
}
|
||||||
@ -1244,7 +1244,6 @@ JanetAsyncStatus ev_machine_read(JanetListenerState *s, JanetAsyncEvent event) {
|
|||||||
status = WSARecv((SOCKET) s->stream->handle, &state->wbuf, 1,
|
status = WSARecv((SOCKET) s->stream->handle, &state->wbuf, 1,
|
||||||
NULL, &state->flags, &state->overlapped, NULL);
|
NULL, &state->flags, &state->overlapped, NULL);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (status && (WSA_IO_PENDING != WSAGetLastError())) {
|
if (status && (WSA_IO_PENDING != WSAGetLastError())) {
|
||||||
janet_cancel(s->fiber, janet_ev_lasterr());
|
janet_cancel(s->fiber, janet_ev_lasterr());
|
||||||
return JANET_ASYNC_STATUS_DONE;
|
return JANET_ASYNC_STATUS_DONE;
|
||||||
|
@ -502,6 +502,7 @@ typedef void *JanetAbstract;
|
|||||||
|
|
||||||
#define JANET_STREAM_CLOSED 0x1
|
#define JANET_STREAM_CLOSED 0x1
|
||||||
#define JANET_STREAM_SOCKET 0x2
|
#define JANET_STREAM_SOCKET 0x2
|
||||||
|
#define JANET_STREAM_ICOP 0x4
|
||||||
#define JANET_STREAM_READABLE 0x200
|
#define JANET_STREAM_READABLE 0x200
|
||||||
#define JANET_STREAM_WRITABLE 0x400
|
#define JANET_STREAM_WRITABLE 0x400
|
||||||
#define JANET_STREAM_ACCEPTABLE 0x800
|
#define JANET_STREAM_ACCEPTABLE 0x800
|
||||||
|
Loading…
x
Reference in New Issue
Block a user