forked from LBRYCommunity/lbry-sdk
request.notifyFinish
This commit is contained in:
parent
85d610bcdf
commit
9fedf14e55
1 changed files with 5 additions and 0 deletions
|
@ -377,6 +377,9 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
||||||
f.write("rpcpassword=" + password)
|
f.write("rpcpassword=" + password)
|
||||||
log.info("Done writing lbrycrd.conf")
|
log.info("Done writing lbrycrd.conf")
|
||||||
|
|
||||||
|
def _responseFailed(self, err, call):
|
||||||
|
call.cancel()
|
||||||
|
|
||||||
def render(self, request):
|
def render(self, request):
|
||||||
request.content.seek(0, 0)
|
request.content.seek(0, 0)
|
||||||
# Unmarshal the JSON-RPC data.
|
# Unmarshal the JSON-RPC data.
|
||||||
|
@ -416,6 +419,7 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
||||||
d = defer.maybeDeferred(function)
|
d = defer.maybeDeferred(function)
|
||||||
else:
|
else:
|
||||||
d = defer.maybeDeferred(function, *args)
|
d = defer.maybeDeferred(function, *args)
|
||||||
|
request.notifyFinish().addErrback(self._responseFailed, d)
|
||||||
d.addErrback(self._ebRender, id)
|
d.addErrback(self._ebRender, id)
|
||||||
d.addCallback(self._cbRender, request, id, version)
|
d.addCallback(self._cbRender, request, id, version)
|
||||||
return server.NOT_DONE_YET
|
return server.NOT_DONE_YET
|
||||||
|
@ -440,6 +444,7 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
||||||
except:
|
except:
|
||||||
f = jsonrpclib.Fault(self.FAILURE, "can't serialize output")
|
f = jsonrpclib.Fault(self.FAILURE, "can't serialize output")
|
||||||
s = jsonrpclib.dumps(f, version=version)
|
s = jsonrpclib.dumps(f, version=version)
|
||||||
|
|
||||||
request.setHeader("content-length", str(len(s)))
|
request.setHeader("content-length", str(len(s)))
|
||||||
request.write(s)
|
request.write(s)
|
||||||
request.finish()
|
request.finish()
|
||||||
|
|
Loading…
Reference in a new issue