]> Joshua Wise's Git repositories - netwatch.git/blobdiff - net/rfb.c
stupid reordering of frees
[netwatch.git] / net / rfb.c
index 903eb6586e278940f48fdb32b6d791c17f5785df..8e5ab91b1732ae093e5ca9997944caa39d1b2f76 100644 (file)
--- a/net/rfb.c
+++ b/net/rfb.c
@@ -16,7 +16,7 @@
 #define POINTER_EVENT          5
 #define CLIENT_CUT_TEXT                6
 
-#define RFB_BUF_SIZE   512
+#define RFB_BUF_SIZE   1536
 
 #define SCREEN_CHUNKS_X 8
 #define SCREEN_CHUNKS_Y 8
@@ -181,7 +181,7 @@ static int advance_chunk(struct rfb_state *state) {
                state->chunk_ynum = 0;
                state->send_state = SST_IDLE;
                if (!(state->chunk_actually_sent))
-                       state->try_in_a_bit = 2;
+                       state->try_in_a_bit = 1;
                        return 1;
        }
 
@@ -255,7 +255,6 @@ static void send_fsm(struct tcp_pcb *pcb, struct rfb_state *state) {
                                /* Checksum gets set in data block, AFTER the data has been sent. */
                        }
 
-                       outputf("actually sent");
                        state->chunk_actually_sent = 1;
 
                        /* Send a header */
@@ -334,13 +333,13 @@ static err_t rfb_sent(void *arg, struct tcp_pcb *pcb, uint16_t len) {
 
 static err_t rfb_poll(void *arg, struct tcp_pcb *pcb) {
        struct rfb_state *state = arg;
-       send_fsm(pcb, state);
        if (state->try_in_a_bit) {
                state->try_in_a_bit--;
                if (!(state->try_in_a_bit)) {
                        state->update_requested = 1;
                }
        }
+       send_fsm(pcb, state);
 /*
        stats_display();
 */
@@ -352,8 +351,8 @@ static void close_conn(struct tcp_pcb *pcb, struct rfb_state *state) {
        tcp_arg(pcb, NULL);
        tcp_sent(pcb, NULL);
        tcp_recv(pcb, NULL);
-       mem_free(state);
        mem_free(state->blockbuf);
+       mem_free(state);
        tcp_close(pcb);
        outputf("close_conn: done");
 }
@@ -367,10 +366,10 @@ enum fsm_result {
 static enum fsm_result recv_fsm(struct tcp_pcb *pcb, struct rfb_state *state) {
        int i;
        int pktsize;
-
+/*
        outputf("RFB FSM: st %d rp %d wp %d", state->state, state->readpos,
                state->writepos);
-
+*/
        switch(state->state) {
        case ST_BEGIN:
                if (state->writepos < 12) return NEEDMORE;
@@ -429,7 +428,6 @@ static enum fsm_result recv_fsm(struct tcp_pcb *pcb, struct rfb_state *state) {
        case ST_MAIN:
                if (state->writepos < 1) return NEEDMORE;
 
-               outputf("RFB: cmd %d", state->data[0]);
                switch (state->data[0]) {
 
                case SET_PIXEL_FORMAT:
@@ -553,7 +551,9 @@ static err_t rfb_recv(void *arg, struct tcp_pcb *pcb,
        }
 
        copylen = pbuf_copy_partial(p, state->data + state->writepos, p->tot_len, 0);
+
        outputf("RFB: Processing %d, wp %d, cp %d", p->tot_len, state->writepos, copylen);
+
        state->writepos += p->tot_len;
 
        tcp_recved(pcb, p->tot_len);
@@ -566,8 +566,6 @@ static err_t rfb_recv(void *arg, struct tcp_pcb *pcb,
                        goto doneprocessing;
 
                case OK:
-                       outputf("RFB FSM: ok");
-
                        if (state->readpos == state->writepos) {
                                state->readpos = 0;
                                state->writepos = 0;
This page took 0.025455 seconds and 4 git commands to generate.