Ubus: Is this a bug in ubusd.c?

Ive been browsing the code in ubusd.c and I've seen something that appears to be a bug.
In function client_cb there is this bit of code...

/* first try to tx more pending data */
	while ((ub = ubus_msg_head(cl))) {
		int written;

		written = ubus_msg_writev(sock->fd, ub, cl->txq_ofs);
		if (written < 0) {
			switch(errno) {
			case EINTR:
			case EAGAIN:
				break;
			default:
				goto disconnect;
			}
			break;
		}

		cl->txq_ofs += written;
		if (cl->txq_ofs < ub->len + sizeof(ub->hdr))
			break;

		ubus_msg_dequeue(cl);
	}

In the case where errno is EAGAIN or EINTR, written will be <0 and the code will then add its value to cl->txq_ofs.
Shouldn't the code only update cl->txq_ofs etc when written is > 0? Isn't the usual thing to do when errno is EAGAIN/EINTR retry the write call?
Apologies if I've missed something obvious here.

You likely misinterepreted the break statement(s).

If error value is EINTR/EAGAIN, the first break pops out from the switch statement to the second break, which jumps out from the outer while loop bypassing the cl->... code block.

At least that is how I read the code.

Duh. I wasn't paying close enough attention. I didn't even notice the second break, even though I knew something like that was required,