mirror of
https://github.com/status-im/nim-raft.git
synced 2025-02-26 20:00:40 +00:00
fix
This commit is contained in:
parent
fe5c069ac7
commit
63c9710506
8
pipe.sh
8
pipe.sh
@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
x=''
|
|
||||||
while [ t ];
|
|
||||||
do
|
|
||||||
$(`$x < RAFTNODESENDMSGRESPPIPE`);
|
|
||||||
echo "$($x)" > RAFTNODERECEIVEMSGPIPE;
|
|
||||||
done
|
|
@ -5,8 +5,8 @@ import sys
|
|||||||
import errno
|
import errno
|
||||||
import msgpack
|
import msgpack
|
||||||
|
|
||||||
writeFIFO = '/home/raych/prg/nim-raft/RAFTNODESENDMSGRESPPIPE'
|
writeFIFO = '/home/raych/prg/nim-raft/RAFTNODERECEIVEMSGPIPE'
|
||||||
readFIFO = '/home/raych/prg/nim-raft/RAFTNODERECEIVEMSGPIPE'
|
readFIFO = '/home/raych/prg/nim-raft/RAFTNODESENDMSGRESPPIPE'
|
||||||
|
|
||||||
def writeFifo(data):
|
def writeFifo(data):
|
||||||
with open(writeFIFO, "a") as fw:
|
with open(writeFIFO, "a") as fw:
|
||||||
@ -26,9 +26,8 @@ def readPipe():
|
|||||||
class MainHandler(tornado.web.RequestHandler):
|
class MainHandler(tornado.web.RequestHandler):
|
||||||
def post(self):
|
def post(self):
|
||||||
s = self.request.body.decode("utf-8")
|
s = self.request.body.decode("utf-8")
|
||||||
print(s)
|
|
||||||
writeFifo(s)
|
writeFifo(s)
|
||||||
self.write(msgpack.dumps(readPipe()))
|
self.write(readPipe())
|
||||||
|
|
||||||
def get(self):
|
def get(self):
|
||||||
self.write("Hello, world")
|
self.write("Hello, world")
|
||||||
@ -42,7 +41,6 @@ def make_app():
|
|||||||
async def main():
|
async def main():
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print("Usage: tornado_simple_raft_node_server.py <port>")
|
print("Usage: tornado_simple_raft_node_server.py <port>")
|
||||||
shutdown_event.set()
|
|
||||||
return
|
return
|
||||||
app = make_app()
|
app = make_app()
|
||||||
app.listen(int(sys.argv[1]))
|
app.listen(int(sys.argv[1]))
|
||||||
@ -56,7 +54,7 @@ if __name__ == "__main__":
|
|||||||
if oe.errno != errno.EEXIST:
|
if oe.errno != errno.EEXIST:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
readPipe()
|
# readPipe()
|
||||||
|
|
||||||
asyncio.run(main())
|
asyncio.run(main())
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user