aboutsummaryrefslogtreecommitdiff
path: root/client/acronc/handler_socket.c
diff options
context:
space:
mode:
authorTrumeet <yuuta@yuuta.moe>2022-08-09 18:46:45 -0700
committerTrumeet <yuuta@yuuta.moe>2022-08-09 18:46:45 -0700
commit6f2cfc118701b59d96862199204aef7834f9db86 (patch)
treeafce2dc865458796912962cdab288699617de730 /client/acronc/handler_socket.c
parent7edaa14c2c822e5b776edaa6534753b258d29488 (diff)
downloadacron-6f2cfc118701b59d96862199204aef7834f9db86.tar
acron-6f2cfc118701b59d96862199204aef7834f9db86.tar.gz
acron-6f2cfc118701b59d96862199204aef7834f9db86.tar.bz2
acron-6f2cfc118701b59d96862199204aef7834f9db86.zip
fix(libacron/acronc/helloworld): ac_receive: 'read' should be the delta value of bytes read in the call, not the absolute position
Also clearify that 'read' is undefined if the function fails.
Diffstat (limited to 'client/acronc/handler_socket.c')
-rw-r--r--client/acronc/handler_socket.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/client/acronc/handler_socket.c b/client/acronc/handler_socket.c
index c0a9923..8a2dc4d 100644
--- a/client/acronc/handler_socket.c
+++ b/client/acronc/handler_socket.c
@@ -128,7 +128,7 @@ static void on_read(uv_stream_t *tcp, ssize_t nread, const uv_buf_t *buf) {
size_t pos = 0;
size_t read = 0;
bool again = false;
- while (read < nread || again) {
+ while (pos < nread || again) {
if (again) {
LOGD("Clearing backlog.");
r = ac_receive(ac_conn, NULL, 0, 0, &obj, NULL);
@@ -146,6 +146,7 @@ static void on_read(uv_stream_t *tcp, ssize_t nread, const uv_buf_t *buf) {
free(buf->base);
return;
}
+ LOGDV("Read %u / %u bytes.", pos, nread);
if (!ready) {
enum ac_connection_state state;