diff options
-rw-r--r-- | lib9p/srv.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib9p/srv.c b/lib9p/srv.c index 0a561d3..1e52609 100644 --- a/lib9p/srv.c +++ b/lib9p/srv.c @@ -282,19 +282,18 @@ void lib9p_srv_read(struct lib9p_srv *srv, lo_interface net_stream_conn _conn) { .initialized = false, }; for (;;) { - nextmsg: /* Read the message. */ size_t done = 0; uint8_t buf[7]; if (read_exactly(conn.fd, buf, 4, &done)) - goto close; + break; size_t goal = uint32le_decode(buf); if (goal < 7) { nonrespond_errorf("T-message is impossibly small"); - goto close; + break; } if (read_exactly(conn.fd, buf, 7, &done)) - goto close; + break; struct _lib9p_srv_req req = { .parent_sess = &sess, .tag = uint16le_decode(&buf[5]), @@ -313,14 +312,14 @@ void lib9p_srv_read(struct lib9p_srv *srv, lo_interface net_stream_conn _conn) { goal, sess.max_msg_size); respond_error(&req); - goto nextmsg; + continue; } req.net_bytes = malloc(goal); assert(req.net_bytes); memcpy(req.net_bytes, buf, done); if (read_exactly(conn.fd, req.net_bytes, goal, &done)) { free(req.net_bytes); - goto close; + break; } /* Handle the message... */ @@ -331,7 +330,6 @@ void lib9p_srv_read(struct lib9p_srv *srv, lo_interface net_stream_conn _conn) { /* ...but usually in another coroutine. */ _lib9p_srv_reqch_send_req(&srv->_reqch, &req); } - close: if (sess.reqs.len == 0) io_close(conn.fd); else { |