Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


*** empty log message ***
Jack Lange [Mon, 8 Sep 2008 20:17:30 +0000 (20:17 +0000)]
palacios/src/geekos/socket.c

index 4c4d44b..3797cae 100644 (file)
@@ -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);
 }