69 Commits
Author SHA1 Message Date
Kenton Varda 65edaa8a57 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-06-20 14:28:00 -07:00
Kenton Varda 27ef02fac9 Support "flat" encoding, and "packed-flat" too. 2016-03-27 07:16:58 -07:00
Kenton Varda 39743ab28a Include Javascript stack when converting to KJ exception. 2016-03-27 07:16:58 -07:00
Kenton Varda 1c39e04adf Merge pull request #27 from zarvox/parse-packed
Add support for parsing structures in Cap'n Proto's packed encoding
2016-02-18 20:00:23 -08:00
Drew Fisher dcf1b10278 Make the overhead computation look less like it has an integer underflow 2016-02-18 19:00:57 -08:00
Drew Fisher ccdb72c931 Compute a tighter upper bound on the buffer needed for packed encoding 2016-02-18 15:48:41 -08:00
Drew Fisher 09c79de07d Add tests for packed encoding/decoding. 2016-02-18 15:11:13 -08:00
Drew Fisher b013752ed5 Add support for serializing structures to packed Cap'n Proto encoding 2016-02-18 14:00:10 -08:00
Drew Fisher 6b899a4250 Add support for parsing structures in Cap'n Proto's packed encoding 2016-02-18 12:03:03 -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
Kenton Varda 5266df2ac6 Add some logging code to attempt to track down the event-loop-deadlocking bug, which apprently isn't fixed.
This change might inadvertently fix the problem, if it related to doRun() receiving a non-zero status.
2015-10-05 22:06:16 -07:00
Kenton Varda db34d99401 Properly close UV handles.
It turns out that you need to call uv_close() on all handles, but the libuv documentation does a remarkably good job of hiding this fact by not discussing it in any intros nor showing it in any examples.

In particular, UvEventPort was repeatedly re-initializing a timer handle over an existing handle that had been stopped but not closed (I had assumed "stop" also cleaned up).

In practice, the effect of this problems seems to be that on very rare occasion, the KJ<->UV glue will stop operating, such that the KJ event loop no longer dispatches any events. The problem only seems to occur on heavily-loaded servers and even then is rare. Possibly memory was being leaked as well, but if so, not very much.

(Actually, as of now I am not certain that this change fixes that problem, but I am certain that the code was wrong before this change.)
2015-09-29 12:38:02 -07:00
Kenton Varda c5207b697b Merge pull request #23 from jparyani/set-anypointer-with-cap
Allow setting AnyPointer fields with a capability
2015-06-12 16:19:13 -07:00
Jason Paryani 38c2366d79 Handle local caps properly when converting from AnyPointer 2015-06-12 15:50:27 -07:00
Jason Paryani ad69dc7bd8 Allow setting AnyPointer fields with a capability
This is blocked on https://github.com/sandstorm-io/capnproto/pull/214
2015-06-10 16:06:56 -07:00
Kenton Varda 8ab80bdf4c Merge pull request #21 from dwrensha/param-list
Fix off-by-one bug for methods with non-inline param list.
2015-06-05 14:29:12 -07:00
David Renshaw 3ef506cd94 Fix off-by-one bug for methods with non-inline param list. 2015-06-05 11:14:30 -04:00
Kenton Varda f8b1741b7e Merge pull request #20 from jparyani/fix-error-type
Rename error.type to kjType
2015-06-04 16:07:45 -07:00
Jason Paryani f74f71a580 Also rename type->kjType for converting from js exceptions 2015-06-04 15:49:07 -07:00
Jason Paryani 0e4602fd8c Rename error.type to kjType
This a workaround due to a v8 bug:
https://code.google.com/p/v8/issues/detail?id=2397
2015-06-04 13:36:47 -07:00
Kenton Varda 10a149f333 Merge pull request #19 from jparyani/add-any-pointer-capability
Handle Capabilities that are typed as AnyPointers
2015-05-29 16:09:26 -07:00
Jason Paryani 32380dd1a6 Handle Capabilities that are typed as AnyPointers 2015-05-29 15:22:42 -07:00
Kenton Varda 54ad340ecf Cleanup: Remove #ifdefs to handle pre-0.5.x. 2015-05-28 17:17:35 -07:00
Kenton Varda 1199aa284a Cleanup: Use new capnp::Type to eliminate hacks. 2015-05-28 17:14:51 -07:00
Kenton Varda 069df22577 Support constants. 2015-04-14 22:36:18 -07:00
Kenton Varda c670620fba Merge pull request #17 from jparyani/fix-null-fields
Change fieldFromJs to allow setting fields as null/undefined
2015-04-03 12:24:36 -07:00
Jason Paryani c1b498b8fd Change fieldFromJs to allow setting fields as null/undefined
Before this, string fields would accept null/undefined, and immediately
call toString() on them, resulting in "null"/"undefined". Other field
types would error out. Now we allow setting fields as null/undefined, so
doing something like:

myCap.myMethod(1, "2", null, "4", myObj["notAKey"])

is possible.
2015-03-30 17:20:02 -07:00
Kenton Varda 64350ed4e0 Merge pull request #15 from jimfleming/engines
Adding engines field to warn the user about node compatibility
2015-03-23 19:29:15 -07:00
jimfleming 64dd020da8 Adding engines field to warn the user about node compatibility per https://docs.npmjs.com/files/package.json#engines 2015-03-22 12:52:59 -07:00
Kenton Varda f35875ee9f Merge pull request #13 from dwrensha/export-bootstrap
Allow clients to export a bootstrap capability.
2015-03-01 19:17:22 -08:00
David Renshaw a28896abb7 explicit move to avoid copy 2015-03-01 21:59:17 -05:00
Kenton Varda 714122b192 Merge pull request #12 from dwrensha/typo
fix typos
2015-03-01 15:48:27 -08:00
David Renshaw 9475b992ab add documentation 2015-02-26 13:37:58 -05:00
David Renshaw 785778e81b Allow clients to export a bootstrap capability. 2015-02-26 13:36:05 -05:00
David Renshaw c2cb839cac fix typos 2015-02-25 14:24:29 -05:00
Kenton Varda 00dd6bb16c Merge pull request #11 from jparyani/fix-int64-fields
Fix toJsParams not properly respecting types of fields
2015-02-24 15:10:07 -08:00
Jason Paryani b748000f52 Fix toJsParams not properly respecting types of fields
This would cause problems with large (u)int64_t fields
2015-02-24 14:12:45 -08:00
Kenton Varda 87e11a8108 Merge pull request #10 from davelab6/patch-1
Update README.md
2015-02-23 12:54:49 -08:00
Dave Crossland 0227824230 Update README.md
Point to https://github.com/capnp-js which is actively maintained
2015-02-21 21:11:27 -05:00
Kenton Varda e61c1d9f87 Merge pull request #9 from jparyani/fix-any-pointer
Handle incoming AnyPointers by transforming them to a byte message
2015-02-19 21:37:33 -08:00
Jason Paryani 9f935d64f5 Rename _id to typeId 2015-02-19 16:30:48 -08:00
Jason Paryani 82d1fe0550 Add _id field for imported modules 2015-02-19 13:47:31 -08:00
Jason Paryani 17f7e2b273 Handle incoming AnyPointers by transforming them to a byte message 2015-02-19 11:27:37 -08:00
Kenton Varda 933b8cb67d Add missing files from previous commit. 2015-01-22 15:04:23 -08:00
Kenton Varda ac8c1a61c2 Update to support building with Ekam.
See: https://github.com/sandstorm-io/ekam

This will allow easier integration into the Sandstorm build, without re-publishing the package every time Sandstorm needs a minor change.
2015-01-22 13:25:01 -08:00
Kenton Varda dc538dd4ce Update for Cap'n Proto EventPort API change for cross-thread wakeup. 2014-12-08 22:41:08 -08:00
Kenton Varda fad577c18a Update for kj::Exception change in Cap'n Proto master. 2014-11-29 00:33:06 -08:00
Kenton Varda dca1c08575 Fix for recent Cap'n Proto changes. 2014-11-03 20:52:03 -08:00