This commit is contained in:
Raycho Mukelov 2023-09-12 12:50:40 +03:00
parent 1f683dd2a7
commit 491b9129f6
2 changed files with 6 additions and 2 deletions

View File

@ -37,18 +37,20 @@ proc TestRaftMessageSendCallbackCreate(): RaftMessageSendCallback =
host = c.host host = c.host
port = c.port port = c.port
var var
client = newAsyncHttpClient() client = newHttpClient()
s = MsgStream.init() # besides MsgStream, you can also use Nim StringStream or FileStream s = MsgStream.init() # besides MsgStream, you can also use Nim StringStream or FileStream
s.pack(msg) #here the magic happened s.pack(msg) #here the magic happened
var var
resp = await client.post(fmt"http://host:port", s.data) resp = client.post(fmt"http://{host}:{port}", s.data)
echo resp.status echo resp.status
var var
ss = MsgStream.init(resp.body) ss = MsgStream.init(resp.body)
xx: RaftMessageResponseBase xx: RaftMessageResponseBase
ss.unpack(xx) #and here too ss.unpack(xx) #and here too
result = xx result = xx

View File

@ -48,6 +48,8 @@ async def main():
if __name__ == "__main__": if __name__ == "__main__":
try: try:
readFIFO = readFIFO + sys.argv[1]
writeFIFO = writeFIFO + sys.argv[1]
os.mkfifo(readFIFO) os.mkfifo(readFIFO)
os.mkfifo(writeFIFO) os.mkfifo(writeFIFO)
except OSError as oe: except OSError as oe: