1
0
mirror of https://github.com/janet-lang/janet synced 2024-06-25 22:53:16 +00:00
Commit Graph

2012 Commits

Author SHA1 Message Date
Calvin Rose
9abee3f29a Add semi-colon. 2021-09-17 19:20:59 -05:00
Calvin Rose
bf9b6b1301 Avoid including windows.h in janet.h for JanetOSMutex. 2021-09-17 16:59:50 -05:00
Calvin Rose
da2c1be49c Fix #801 threaded abstract cyclic references in marshalling.
We forgot to mark threaded abstract types as "seen" when marshalling so
we would mistakenly marshal them twice. This messed up unmarshalling.
2021-09-14 21:12:02 -05:00
Jonathan Marler
e381622a9a add NULL check in gc.c to avoid UB
After the UB was fixed in value.c, I tried running the build again and encoutered another instance of UB in gc.c.  With this fixed I can now build janet with ubsan enabled, meaning there's no more UB encountered in janet_boot during the build.
2021-09-11 19:50:52 -06:00
sogaiu
e6ee867f72 Tweak math/nan docstring 2021-09-11 16:54:35 +09:00
bakpakin
468a31f515 Address #795 - add NULL check to avoid UB 2021-09-09 07:20:26 -05:00
bakpakin
02d2a66ef2 Merge branch 'master' of github.com:janet-lang/janet 2021-09-07 22:44:59 -05:00
Calvin Rose
4638baf545
Merge pull request #790 from llmII/feature-getsockname-getpeername
Work in progress - more socket functions
2021-09-07 22:44:40 -05:00
bakpakin
b39b1746ba Support bindport. 2021-09-07 21:59:17 -05:00
bakpakin
24f97510b0 Fix incorrect code that created socket twice. 2021-09-07 20:51:33 -05:00
llmII
325d5399fa
Code cleanup and attribution set.
All that is left is to test unix sockets.
2021-09-07 20:00:00 -05:00
Calvin Rose
d8f6fbf594
Merge pull request #789 from llmII/feature-bind-connect
Add bind option to net/connect
2021-09-07 18:47:17 -05:00
llmII
bf2928805e
Had an extra plen definition, removed. 2021-09-07 17:03:34 -05:00
llmII
7d2bf334c8
Fix incorrect error when argv[3] is null
The `janet_get_addrinfo` function retained code that was meant for
compliance with 3 separate function signatures under a single function
name. Changing things to be a single function signature was broken until
the code pertaining to the aforementioned was stripped out.
2021-09-07 16:11:37 -05:00
llmII
7446802a70
Quit trying to make it 3 different functions
Prior commits was an attempt to make this one function adhere to 3
different function signatures! This puts an end to that and makes it
where it's a single function signature and if one wants to use the 4th
argument they'll need to explicitly set the 3rd argument (to nil for
default).
2021-09-07 14:56:13 -05:00
llmII
c9bef39f96
Make net/connect special
Keeps net/listen from being affected by changes necessary to make bind
on connect work (while keeping from breaking the API).
2021-09-07 05:40:48 -05:00
llmII
3740eadb7d
Seeing if this fixes the last warnings for Windows 2021-09-06 19:57:56 -05:00
llmII
e29fa66a74
More Windows fixes 2021-09-06 19:42:45 -05:00
llmII
ca5406c8e4
More windows fixes
MSVC's output via appveyor is a little lacking in indication of all
issues so I'm hitting them as I can find them.
2021-09-06 19:31:16 -05:00
llmII
7217caacd1
Attempting some more windows related fixes. 2021-09-06 19:26:33 -05:00
Calvin Rose
8081082251
Merge pull request #785 from llmII/feature-kqueue
Add kqueue support to Janet
2021-09-06 18:42:05 -05:00
llmII
1597ca0de5
Cleanup code a bit
Inconsistent indentation and such fixed, superfluous newlines removed,
documentation of new functions.
2021-09-06 18:32:23 -05:00
llmII
8c938ceff9
Fix for Windows (possibly)
Windows does not have <arpa/inet.h> so only include it when not Windows.
2021-09-06 17:48:17 -05:00
llmII
65a6945ea5
Finalize peername and localname
Both now do the right thing and give back all information (host and
port) when possible as a tuple of (host port).
2021-09-06 17:35:49 -05:00
llmII
02640812af
Add getsockname (net/localname) 2021-09-06 17:01:09 -05:00
llmII
ba761d5c35
Work in progress - more socket functions
When this is complete we'll have getpeername, getsockname and possibly
getpeerid in the net/* API.
2021-09-06 16:15:01 -05:00
llmII
48a3b1f07f
Enable kqueue on MacOS
Make sure JANET_EV_KQUEUE is defined when JANET_APPLE is defined unless
disabled by configuration.
2021-09-06 16:01:06 -05:00
llmII
4370cb77e7
Update documentation.
Documenting the new bindhost parameter to net/connect.
2021-09-06 10:54:11 -05:00
llmII
470e8f6fc7
Reused address info struct incorrectly
Wrongly assumed that `ai` was done being used before binding, it's not,
so create a separate address info for binding...
2021-09-06 10:44:23 -05:00
llmII
b270d88427
More off by one error fixes 2021-09-06 10:12:36 -05:00
llmII
66ce247129
Fixing off by one indexing errors... 2021-09-06 10:01:16 -05:00
llmII
6ad016c587
Check type when getting socket type
janet_get_sockettype expects a keyword but we're making it optional that
the call to the functions that use it with arity >=3 will be guaranteed
to have it as a keyword value! If it's not a keyword then it's the same
as NULL.
2021-09-06 09:53:53 -05:00
llmII
532dac1b95
Check type instead of value
Primarily because trying to check the value results in a panic when the
value is not the type of value requested from the API. Also probably
cheaper and the previous idea of just getting the value then comparing
was pretty stupid (needed a string comparison... and was going to do
pointer comparison).
2021-09-06 09:48:29 -05:00
llmII
2a4bcc262f
Don't bind when address info doesn't exist
Simple logic issue, something overlooked.
2021-09-06 09:06:40 -05:00
llmII
1ce2361daf
Better error message in connect
Quick thing to help check when failing tests.
2021-09-06 09:02:56 -05:00
llmII
6e8584e8e0
Add bind option to net/connect
This will allow us to set the address we use for outgoing connections.

Builds, haven't checked it passes current tests, haven't checked it
actually works either.
2021-09-06 08:54:24 -05:00
llmII
121aa91139
Fixes for NetBSD (again)
Minimum interval for a timer must be 1 or more (or we get EINVAL) and
Janet fails tests and halts events that the programmer may still be
interested in.
2021-09-05 21:48:53 -05:00
llmII
bbc07c72d3
More NetBSD fixes
A comptime known value of 0 for data in EV_SET with EVFILT_TIMER causes
a complete compilation failure (fails to link). This fixes it by making
it a 1 instead of a 0 for amount of milliseconds in the interval to wait
under NetBSD.
2021-09-05 21:17:41 -05:00
llmII
43b48fdbea
More fixes for NetBSD
Kills compiler warnings with regards to implicit conversion of intptr_t
to void*
2021-09-05 21:01:24 -05:00
llmII
604f97aba1
Fixes for BSD where BSD != FreeBSD
NetBSD and OpenBSD lack NOTE_ABSTIME and NOTE_MSECONDS, so we define
those and create a macro that we use for all timeout values in EV_TIMER
events that will on all BSD excepting FreeBSD change an absolute time
into an interval.
2021-09-05 20:48:42 -05:00
Calvin Rose
dc980081cd Fix #783 - change docstring for x86-64 to x64. 2021-09-05 12:32:33 -05:00
llmII
981f03fef3
Remove comments regarding NetBSD breakage
Since those no longer should apply, don't keep them around.
2021-09-05 10:45:45 -05:00
llmII
d40133dc72
NetBSD support
Checking throught NetBSD's man pages, excepting for NetBSD-current,
NetBSD uses `intptr_t` as the type for `.udata`. This change allows for
`.udata` to match whatever type (by cast) the underlying system uses.
2021-09-05 07:30:22 -05:00
llmII
c9fa586fce
Code style fixes (pt 2).
Missed some.
2021-09-04 09:37:07 -05:00
llmII
b847a7d90b
Code style fixes.
Pretty obvious I thought control statements were glued to their opening
parenthesis at first and then I realized not and voila, a bundle of
mixed style. Hopefully this fixes all of it.
2021-09-04 09:34:47 -05:00
llmII
8b67108dc8
Complete kqueue feature
From this point things should be bug fixes or code formatting most
likely.

Updated commentary (removed superfluous comments, and commented out
code). Refined commentary where it seemed important and may help whoever
comes behind me keep from making bad assumptions similar to the ones I
made.

All tests ran with `gmake test` now pass. `valgrind` with FreeBSD does
not support forking so `gmake valtest` fails once child processes are
started. Determined not an issue, can't fix valgrind.
2021-09-04 08:23:03 -05:00
llmII
b559f9625a
Timeout is an absolute time, not an interval.
Fixes the wrong assumption, passing all tests at that point.
2021-09-04 08:02:50 -05:00
llmII
1736c9b0f8
Handle null state, don't read/write on error
Need to guard against errors when reading/writing probably, if there is
an error, forgo those events.

Guard against null state (and the byproduct, a segfault), check if the
state is null before utilizing it.
2021-09-03 23:22:07 -05:00
llmII
4fb2d8d318
Logical error regarding length fixed. 2021-09-03 22:41:59 -05:00
llmII
95891eb0a5
Fix incorrect use of EV_SET on pipes (part 2)
Forgot that we use nearly the same routine for adding and deletion...
can't go around deleting things we haven't put into the changeset!
2021-09-03 22:33:28 -05:00