]> Joshua Wise's Git repositories - netwatch.git/commitdiff
attempting to increase performance
authorJacob Potter <jdpotter@andrew.cmu.edu>
Thu, 4 Dec 2008 22:04:19 +0000 (17:04 -0500)
committerJacob Potter <jdpotter@andrew.cmu.edu>
Thu, 4 Dec 2008 22:04:19 +0000 (17:04 -0500)
lwip/src/include/lwipopts.h
net/rfb.c

index 0b9ebbe7f9f3bbb278b4fe8cd237dc6601fc45c7..a085242ef88c2846236883af2803b29369037e08 100644 (file)
 #define LWIP_DHCP      1
 
 #define MEM_SIZE       65536
-#define TCP_SND_BUF     2048
-#define TCP_MSS         2048
+#define TCP_MSS         1400
+#define TCP_WND                24000
+#define TCP_SND_BUF     (16 * TCP_MSS)
+
+#define MEMP_NUM_PBUF  128
 
 #endif
index eac1bdd94b973b91f73d58d29f8d855945562039..eff9c41dc6267decbe69f3752246d962e16f2121 100644 (file)
--- a/net/rfb.c
+++ b/net/rfb.c
@@ -169,7 +169,7 @@ static void send_fsm(struct tcp_pcb *pcb, struct rfb_state *state) {
        case SST_NEEDS_UPDATE:
                outputf("RFB send: sending header");
                /* Send a header */
-               state->frame_bytes = fb->curmode.xres * fb->curmode.yres * 3; /* XXX */
+               state->frame_bytes = fb->curmode.xres * fb->curmode.yres * fb->curmode.bytestride;
                hdr.msgtype = 0;
                hdr.nrects = htons(1);
                hdr.xpos = htons(0);
@@ -186,33 +186,46 @@ static void send_fsm(struct tcp_pcb *pcb, struct rfb_state *state) {
                /* FALL THROUGH */
 
        case SST_SENDING:
-               left = state->frame_bytes - state->update_pos;
 
-               if (left > tcp_sndbuf(pcb)) {
-                       sndlength = tcp_sndbuf(pcb);
-               } else {
-                       sndlength = left;
-               }
+               while (1) {
+                       left = state->frame_bytes - state->update_pos;
 
-               do {
-                       err = tcp_write(pcb, fb->fbaddr + state->update_pos, sndlength, 0);
-                       if (err == ERR_MEM) {
-                               outputf("RFB: ERR_MEM sending %d", sndlength);
-                               sndlength /= 2;
+                       if (left == 0) {
+                               state->send_state = SST_IDLE;
+                               break;
                        }
-               } while (err == ERR_MEM && sndlength > 1);
 
-               if (err == ERR_OK) {
-                       outputf("RFB: sent %d", sndlength);
-                       state->update_pos += sndlength;
-               } else {
-                       outputf("RFB: send error %d", err);
-               }
+                       if (left > tcp_mss(pcb)) {
+                               sndlength = tcp_mss(pcb);
+                       } else {
+                               sndlength = left;
+                       }
 
-               tcp_output(pcb);
+                       do {
+                               err = tcp_write(pcb, fb->fbaddr + state->update_pos, sndlength, 0);
+                               if (err == ERR_MEM) {
+                                       outputf("RFB: ERR_MEM sending %d", sndlength);
+                                       sndlength /= 2;
+                               }
+                       } while (err == ERR_MEM && sndlength > 1);
 
-               if (state->update_pos == state->frame_bytes) {
-                       state->send_state = SST_IDLE;
+                       if (err == ERR_OK) {
+                               outputf("RFB: attempting send %d", sndlength);
+                       } else {
+                               outputf("RFB: send error %d", err);
+                               break;
+                       }
+
+                       if (tcp_output(pcb) != ERR_OK) {
+                               outputf("RFB: tcp_output has had enough");
+                               break;
+                       }
+
+                       state->update_pos += sndlength;
+
+                       if (tcp_sndbuf(pcb) == 0) {
+                               break;
+                       }
                }
 
                break;
This page took 0.028729 seconds and 4 git commands to generate.