Calvin Rose
1bb9a9368b
Make sure winsock2.h is included before windows.h
...
This should be true in the normal build, and especially in the
amalgamated build.
2020-05-16 12:41:26 -05:00
Calvin Rose
e8b3587946
Silence clang warnings about missing initializers.
2020-05-10 16:00:55 -05:00
Calvin Rose
95660002e1
fix include sys/fcntl.h to fcntl.h
2020-05-07 14:54:03 -05:00
Calvin Rose
084fc9776d
Use SOCK_CLOEXEC correctly.
2020-05-07 07:55:08 -05:00
Calvin Rose
79c3139748
Check for SOCK_CLOEXEC.
...
Not available on all platforms.
2020-05-06 23:44:01 -05:00
Calvin Rose
dc3e9fb77c
Add CLOEXECs when getting file descriptors ( #374 )
...
This should help address leaking file descriptors in multithreaded
programs. There are a few cases where a race can occur though, as
some apis (fopen and mktemp).
2020-05-06 18:33:25 -05:00
Calvin Rose
761ea65d81
Add fiber/roor and allow net/server to take
...
a numeric port.
2020-04-30 23:21:26 -05:00
Calvin Rose
1c0a015cc8
s/WSALastError/WSAGetLastError()/g
2020-04-30 13:26:14 -05:00
Calvin Rose
73989f5cc7
Consolidate windows and posix socket code.
...
Also remove code that ignored sigpipe and instead try
our best to ignore through various platform specific mechanisms.
2020-04-29 21:07:21 -05:00
Calvin Rose
c98e1f3cae
Update documentation for net/read and net/chunk.
2020-04-27 19:26:05 -05:00
Calvin Rose
41894eb285
Add docstrings to net.c
2020-04-26 14:11:47 -05:00
Calvin Rose
d2ebf4b52d
Merge branch 'net'
2020-04-26 12:27:37 -05:00
Calvin Rose
0d3c6abee8
POLLER -> POLLERR
2020-04-18 19:15:59 -04:00
Calvin Rose
4a693222b4
Port net code to windows.
...
Use winsock2 and WSAPoll. Not the most high performance
solution but should work well.
2020-04-18 19:14:38 -04:00
Calvin Rose
2904c19ed9
Switch to poll from select.
...
Simpler and more flexible interface, and also lets
us use epoll more easily on linux, which is the most important
plantform to optimize for network performance.
2020-04-18 15:22:20 -05:00
Calvin Rose
4ac382e553
Add alias JANET_SIGNAL_EVENT.
2020-04-17 16:27:02 -05:00
Calvin Rose
01a79dc965
Remove extra functionality.
2020-02-20 20:10:03 -06:00
Calvin Rose
0df220780a
Fix issues with #282
...
Bad handling of write errors, as well as janet_root_fiber().
2020-02-20 19:54:31 -06:00
Calvin Rose
f4a46ba6ea
Add methods to streams.
...
This makes streams polymorphic with files in many cases.
printf family functions still need porting.
2020-02-12 09:32:41 -06:00
Calvin Rose
79bb9e54d5
Remove direct references to file descriptors.
...
If a descriptor is freed by the Janet code, other
uses of that descriptor, say in the event loop, need
to know that it has been closed.
2020-02-11 08:57:44 -06:00
Calvin Rose
f4d7fd97f6
Working TCP echo server and client.
...
Required a few changes to APIs, namely janet_root_fiber()
to get topmost fiber that is active in the current scheduler.
This is distinct from janet_current_fiber(), which gets the bottom
most fiber in the fiber stack - it might have a parent, and so cannot
be reliably resumed.
This is the kind of situation that makes symmetric coroutines more
attractive.
2020-02-09 20:00:50 -06:00
Calvin Rose
eda61455d3
Work on tcp server code.
2020-02-03 09:29:51 -06:00
Calvin Rose
c0d2140d14
Begin net/ module in core.
...
Humble beginnings.
2020-02-01 20:39:54 -06:00