+ if (lines_left == 0) {
+ state->send_state = SST_HEADER;
+ state->checksums[state->chunk_xnum][state->chunk_ynum] = state->chunk_checksum;
+ if (advance_chunk(state))
+ return;
+ break;
+ }
+
+ lptr = fb->fbaddr
+ + (fb->curmode.xres * fb->curmode.bytestride
+ * (state->chunk_ypos + state->chunk_lindex))
+ + (state->chunk_xpos * fb->curmode.bytestride);
+
+ /* The network card can't DMA from video RAM,
+ * so use TCP_WRITE_FLAG_COPY. */
+ err = tcp_write(pcb, lptr,
+ fb->curmode.bytestride * state->chunk_width, TCP_WRITE_FLAG_COPY);
+
+ if (err == ERR_OK) {
+ state->chunk_lindex += 1;
+ } else {
+ if (err != ERR_MEM)
+ outputf("RFB: send error %d", err);
+
+ return;
+ }
+
+ if (tcp_sndbuf(pcb) == 0) {
+ return;
+ }
+ }