Fix up examples

This commit is contained in:
Jason Paryani
2013-11-15 01:17:35 -08:00
parent 8e1895dd8f
commit fc16eab803
4 changed files with 13 additions and 10 deletions

View File

@@ -8,8 +8,8 @@ class Server:
def __init__(self, val=1):
self.val = val
def foo(self, context):
context.results.x = str(context.params.i * 5 + self.val)
def foo(self, i, **kwargs):
return str(i * 5 + self.val)
def restore(ref_id):
return test_capnp.TestInterface.new_server(Server(100))
@@ -29,8 +29,7 @@ def example_server(host='localhost', port=49999):
restorer = capnp.Restorer(test_capnp.TestSturdyRefObjectId, restore)
server = capnp.RpcServer(loop, stream, restorer)
waiter = capnp.PromiseFulfillerPair()
loop.wait(waiter)
server.run_forever()
except KeyboardInterrupt:
break
except: