107 Commits
Author SHA1 Message Date
Kenton Varda d8de1b49ad Disambiguate getsockname() call. 2019-11-23 11:19:17 -08:00
Kenton Varda 4df200effa Implement KJ's new whenWriteDisconnected(). 2019-02-09 15:31:44 -08:00
Kenton Varda cbb3ab40fb Fix age-old bug with flag combining.
I guess it never cauased a problem because the result was 1 which just happened to map to TAKE_OWNERSHIP and the other flags are safe to skip (just inefficient)...
2019-02-09 15:29:42 -08:00
Kenton Varda 1abd120c12 Update to C++14 as required by Cap'n Proto 0.7. 2019-01-07 13:40:56 -08:00
Kenton Varda ca30a96c1c Merge pull request #43 from qm3ster/patch-1
update capnp-js link
2018-05-14 15:27:29 -07:00
Mihal Malostanidis d2f4c72d64 update capnp-js link
Reorganization in progress
2018-05-08 00:02:48 +03:00
Kenton Varda 202e13c66f Hack: For Sandstorm build, catch segfaults and print stack traces. 2018-04-15 17:28:00 -07:00
Kenton Varda a3e975d43c Bump version number and publish again because apparently npm went and published a 13MB scratch folder I had in the directory last time, wtf. 2018-02-09 08:43:47 -08:00
Kenton Varda f1e9306cd6 Release 0.3.0 which supports node 8+. 2018-02-04 14:17:42 -08:00
Kenton Varda c6fe3c2624 Revert "Add temporary code to count local capability types and support dumping them to stderr periodically."
This reverts commit 74958750f1.

This is no longer needed.
2018-02-04 14:16:01 -08:00
Kenton Varda 7fb9018515 Correctly handle pipelining on a Capability. 2018-02-04 14:12:01 -08:00
Kenton Varda 742d6b5b79 Fix obvious, glaring memory leak. I dunno what to say. 2018-01-06 12:17:56 -08:00
Kenton Varda ec1721f298 Node 8: Properly support capabilities defined using ES6 classes.
I'm not sure why this worked with Node 4 / Meteor 1.5, but behavior changed in Node 8 / Meteor 1.6.
2017-11-18 16:50:37 -08:00
Kenton Varda 5aeffa328a Node 8: Transition from V8 hidden values to V8 private values. 2017-11-18 16:49:55 -08:00
Kenton Varda 1609fa1155 Merge branch 'node4' of github.com:kentonv/node-capnp into node4 2017-09-30 12:05:53 -07:00
Kenton Varda f575e4013c Add the ability to listen on a unix socket delivering connections via SCM_RIGHTS. 2017-09-30 12:05:30 -07:00
Kenton Varda 6525163b1b Update for recent KJ changes. Fixes #36. 2017-09-30 12:04:57 -07:00
Kenton Varda 7afd129314 Merge pull request #31 from dwrensha/capnp-node-is-missing
Fix error message: 'capnp.node.node' -> 'capnp.node'
2017-09-30 12:03:17 -07:00
Kenton Varda f2bfd6f95f Release 0.2.0 which supports node 4+. 2017-09-19 09:25:56 -07:00
Kenton Varda 888f772ef3 Fix several v8 usage bugs that could be causing our memory leaks.
- You can't just call SetWeak() on a handle and then let the handle go out-of-scope. You have to Reset() it when the weak callback is called. Honestly unsure why this doesn't crash.
- The weak handle should have MarkIndependent() called on it, otherwise v8 is less aggressive about GCing it.
- OwnHandle's move semantics were broken. They created a copy (which actually creates a new v8 persistent handle), but then zero'd the original (which means it would never be cleaned up by v8). V8 provides a nice `Global` type which has the semantics we always wanted, so use that.
2017-04-29 15:46:07 -07:00
Kenton Varda fbdb9959a9 Revert "Work around apparent memory leak in Node?"
After deploying this change, the frequency of production problems seems to have increased rather than decreased. I don't know if this change is the reason for the increase, but since it did not accomplish its sole goal of decreasing the problem rate, I'm reverting it.

This reverts commit 8497d70320.
2017-03-01 14:20:44 -08:00
Kenton Varda 816cbc38e0 Add a chacha20() function for Sandstorm's use, and add #ifdefs so that Sandstorm-private code isn't included in non-Sandstorm builds. 2017-02-16 20:06:05 -08:00
Kenton Varda 8497d70320 Work around apparent memory leak in Node? 2017-02-14 02:51:54 -08:00
Kenton Varda 4f251bedc6 Merge pull request #32 from kentonv/powerbox-query
Implement Sandstorm powerbox query matching algorithm as a library function.
2016-12-07 23:03:56 -08:00
Kenton Varda 8dbc7e700d Update test per @dwrensha's review comments. 2016-12-05 10:43:52 -08:00
Kenton Varda 1d0caa3f30 Support 'null' appearing in pointer lists. 2016-12-05 10:43:27 -08:00
Kenton Varda 302ae1779f Implement Sandstorm powerbox query matching algorithm as a library function.
Algorithm documented here: https://github.com/sandstorm-io/sandstorm/blob/master/src/sandstorm/powerbox.capnp#L115

Although this is Sandstorm-specific, I'm putting it into node-capnp for convenience: this needs to be implemented in C++, and it would be surprisingly difficult to create a second Node module that shares the Cap'n Proto library with capnp.node.
2016-12-04 16:58:10 -08:00
Kenton Varda 8e001b1ff1 Update for change to wrapConnectingSocketFd() signature. 2016-11-30 18:34:06 -08:00
Kenton Varda 492b1c9905 Fix closeAll(). 2016-11-12 13:20:00 -08:00
David Renshaw dd23d9bc5c Fix error message: 'capnp.node.node' -> 'capnp.node' 2016-11-05 19:23:09 -04:00
Kenton Varda 74958750f1 Add temporary code to count local capability types and support dumping them to stderr periodically. 2016-11-03 15:33:07 -07:00
Kenton Varda 05d868bc8f Do type checking / unwrapping the right way.
GetAlignedPoniterFromInternalField() can crash if the internal field is not a pointer, so we can't use this trick of checking if the field contains a pointer to the type's type_info.

The correct thing to do is use FunctionTemplate::HasInstance() to type-check the value. To do that, we of course have to have a reference to the FunctionTemplate already. To make this lookup fast, I used template-static-singletons.
2016-08-08 19:55:52 -07:00
Kenton Varda f48e50e7ff Don't download/install ES6 Promise polyfill anymore. 2016-08-08 18:55:05 -07:00
Kenton Varda 674090dba2 Silence some warnings originating in macros. 2016-08-08 18:54:44 -07:00
Kenton Varda 2b241848f5 Fix RPC callbacks using node::MakeCallback(). 2016-08-08 18:33:08 -07:00
Kenton Varda 4f2ee9bb8f Fix random crashes during GC.
This switches from the (apparently deprecated) WeakCallbackData-based SetWeak() to the newer WeakCallbackInfo-based one.

I have no fucking idea what the difference is, or what the WeakCallbackType enum is supposed to mean, or why it didn't work before. There is no documentation. There are various pages around the internet that make reference to this API but no comprehensive explanation anywhere as to the details. You're supposed to just know, or something.
2016-07-04 02:32:48 -07:00
Kenton Varda 8d57b61bba Promise capabilities take ownership of the capability to which they resolve.
Make sure that the node-level capability is replaced with one that will throw an exception from calls, rather than segfault on null pointer.
2016-07-03 22:13:04 -07:00
Kenton Varda 0c60f1f777 Support "flat" encoding, and "packed-flat" too. 2016-07-03 22:09:33 -07:00
Kenton Varda e3ce43e2be Include Javascript stack when converting to KJ exception. 2016-07-03 22:09:33 -07:00
Drew Fisher f7066436e9 Make the overhead computation look less like it has an integer underflow 2016-07-03 21:58:04 -07:00
Drew Fisher 533aa8043d Compute a tighter upper bound on the buffer needed for packed encoding 2016-07-03 21:56:10 -07:00
Drew Fisher 22a56c1607 Add tests for packed encoding/decoding. 2016-07-03 21:55:28 -07:00
Drew Fisher 7965ca80f5 Add support for serializing structures to packed Cap'n Proto encoding 2016-07-03 21:55:13 -07:00
Drew Fisher 2bdf71bbe2 Add support for parsing structures in Cap'n Proto's packed encoding 2016-07-03 21:49:19 -07:00
Kenton Varda 3d5d0c9d38 Update package.json to reflect the node API chanage. (I'm not actually sure if this works with 0.12, but it definitely doesn't work with 0.10 anymore.) 2016-02-15 19:11:14 -08:00
Kenton Varda 4128f687a8 Expose expectedSizeFromPrefix to node. 2016-02-15 19:05:43 -08:00
Kenton Varda eba8a33e66 Port to Node 4. 2016-02-14 23:33:53 -08:00
Kenton Varda 10e269d298 Void values are normally represented as 'null', so ignoring 'null' fields is wrong. 2016-02-09 18:41:47 -08:00
Kenton Varda 55d9a51855 Treat closed capability as disconnected.
This seems correct, and works around a bug in Sandstorm where a capability shared between multiple components is sometimes closed by one of them. This isn't the best way to fix the bug, but the real fix will require some refactoring.
2015-11-10 09:57:24 -08:00
Kenton Varda 753c11b038 Fix typo in previous commit. 2015-10-05 22:52:48 -07:00