Here my code to implement Redis in C/C++. Now I has 2 problem with 2 branches:
In branch master, I am stuck at Stage #XV6 (Replication - ACKs with no commands). The console show error:
[tester::#XV6] Received: “” (no content received)
[tester::#XV6] ^ error
[tester::#XV6] Error: Expected start of a new RESP2 value (either +, -, :, $ or *)
In branch Refactor-asio, I tried to use async methods and fail at the Stage: The INFO command on a replica#hc6. It shows error: dial tcp 127.0.0.1:6380: connect: connection refused
When I run both branches with 2 test cases local (using redis-server, redis-cli), every thing OK. I has debug every thing but could not find the solution. If you want to write log in my code, you can use the options in the file RedisDef.h. Thanks you for your support
Me too. In the first version, I use system call with file descriptor (read(), write() on posix standard) but I want to try to implement with Asio library. And I guess that mixed between blocking-operation (fwrite()) makes this issue (not sure). Instead, I use read(), write() on file descriptor for the regular file and it solves this issue. But the read(), write() method also blocking-operation, maybe I will replace them in the next refactor Thank for your suggestion.
And about the test case #XV6, It is my code. the master also propagates the GETACK command, and the replica read both binary data and this command at the same time. So I wrote both to persistent file, instead of only binary data . Thank for your support again.