From: Jack Lange Date: Mon, 8 Sep 2008 20:17:30 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: 1.0~42 X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=6cd4226f8e7bc5dfbbbee49fc0aff8154bb22159;p=palacios.git *** empty log message *** --- diff --git a/palacios/src/geekos/socket.c b/palacios/src/geekos/socket.c index 4c4d44b..3797cae 100644 --- a/palacios/src/geekos/socket.c +++ b/palacios/src/geekos/socket.c @@ -22,8 +22,8 @@ void init_network() { for (i = 0; i < MAX_SOCKS; i++) { sockets[i].in_use = 0; - init_queue(&(sockets[i].send_queue)); - init_queue(&(sockets[i].recv_queue)); + init_ring_buffer(&(sockets[i].send_queue), 65535); + init_ring_buffer(&(sockets[i].recv_queue), 65535); } //initiate uIP @@ -127,26 +127,22 @@ static void newdata(int sockfd){ } // not finished yet -static void -senddata(int sockfd){ - uchar_t *bufptr; - int len = 0; - addr_t pkt; +static void senddata(int sockfd) { + struct socket * sock = get_socket_from_fd(sockfd); + int mss = uip_mss(); + int pending_bytes = rb_data_len(&(sock->send_queue)); + int len = (mss < pending_bytes) ? mss: pending_bytes; + int bytes_read = 0; + uchar_t * send_buf = uip_appdata; - struct sockets *sock = get_socket_from_fd(sockfd); - - pkt = dequeue(sock->send_queue); - if (pkt == 0) // no packet for send + bytes_read = rb_peek(&(sock->send_queue), send_buf, len); + + if (bytes_read == 0) { + // no packet for send return; - - bufptr = uip_appdata; - - if(len < uip_mss()) { - // memcpy(bufptr, data, len); - } else { - } - //uip_send(uip_appdata,len); + + uip_send(send_buf, len); }