Prevent the capnproto connection from getting garbage collected.

This commit is contained in:
David Renshaw 2016-09-28 13:40:54 -04:00
parent 95680ef43a
commit 4d6ab3094c

View file

@ -28,10 +28,11 @@ if (isSandstorm && Meteor.isServer) {
Capnp.importSystem('sandstorm/sandstorm-http-bridge.capnp').SandstormHttpBridge;
let httpBridge = null;
let capnpConnection = null;
function getHttpBridge() {
if (!httpBridge) {
const capnpConnection = Capnp.connect('unix:/tmp/sandstorm-api');
capnpConnection = Capnp.connect('unix:/tmp/sandstorm-api');
httpBridge = capnpConnection.restore(null, SandstormHttpBridge);
}
return httpBridge;