Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Sizes in bytes; rework the documentation; uniformize the variable naming schema
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 3 Apr 2006 13:27:47 +0000 (13:27 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 3 Apr 2006 13:27:47 +0000 (13:27 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2054 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/gras/Transport/transport.c
src/gras/Transport/transport_plugin_tcp.c
src/gras/Transport/transport_private.h

index e9869ab..bd52f0c 100644 (file)
@@ -174,15 +174,15 @@ void gras_trp_socket_new(int incoming,
 
 
 /**
 
 
 /**
- * gras_socket_server_ext:
- *
- * Opens a server socket and make it ready to be listened to.
- * In real life, you'll get a TCP socket.
+ * @brief Opens a server socket and makes it ready to be listened to.
+ * @param buf_size: size of the buffer (in byte) on the socket (for TCP sockets only). If 0, a sain default is used (32k, but may change)
+ * 
+ * In real life, you'll get a TCP socket. 
  */
 gras_socket_t
 gras_socket_server_ext(unsigned short port,
                       
  */
 gras_socket_t
 gras_socket_server_ext(unsigned short port,
                       
-                      unsigned long int bufSize,
+                      unsigned long int buf_size,
                       int measurement) {
  
   xbt_ex_t e;
                       int measurement) {
  
   xbt_ex_t e;
@@ -198,7 +198,7 @@ gras_socket_server_ext(unsigned short port,
   gras_trp_socket_new(1,&sock);
   sock->plugin= trp;
   sock->port=port;
   gras_trp_socket_new(1,&sock);
   sock->plugin= trp;
   sock->port=port;
-  sock->bufSize = bufSize;
+  sock->buf_size = buf_size>0 ? buf_size : 32*1024;
   sock->meas = measurement;
 
   /* Call plugin socket creation function */
   sock->meas = measurement;
 
   /* Call plugin socket creation function */
@@ -218,16 +218,16 @@ gras_socket_server_ext(unsigned short port,
 }
    
 /**
 }
    
 /**
- * gras_socket_client_ext:
- *
- * Opens a client socket to a remote host.
- * In real life, you'll get a TCP socket.
+ * @brief Opens a client socket to a remote host.
+ * @param buf_size: size of the buffer (in bytes) on the socket (for TCP sockets only). If 0, a sain default is used (32k, but may change)
+ * 
+ * In real life, you'll get a TCP socket. 
  */
 gras_socket_t
 gras_socket_client_ext(const char *host,
                       unsigned short port,
                       
  */
 gras_socket_t
 gras_socket_client_ext(const char *host,
                       unsigned short port,
                       
-                      unsigned long int bufSize,
+                      unsigned long int buf_size,
                       int measurement) {
  
   xbt_ex_t e;
                       int measurement) {
  
   xbt_ex_t e;
@@ -242,7 +242,7 @@ gras_socket_client_ext(const char *host,
   sock->plugin= trp;
   sock->peer_port = port;
   sock->peer_name = (char*)strdup(host?host:"localhost");
   sock->plugin= trp;
   sock->peer_port = port;
   sock->peer_name = (char*)strdup(host?host:"localhost");
-  sock->bufSize = bufSize;
+  sock->buf_size = buf_size>0 ? buf_size: 32*1024;
   sock->meas = measurement;
 
   /* plugin-specific */
   sock->meas = measurement;
 
   /* plugin-specific */
index 06609af..b360df0 100644 (file)
@@ -68,7 +68,7 @@ static inline void gras_trp_sock_socket_client(gras_trp_plugin_t ignored,
   struct sockaddr_in addr;
   struct hostent *he;
   struct in_addr *haddr;
   struct sockaddr_in addr;
   struct hostent *he;
   struct in_addr *haddr;
-  int size = sock->bufSize * 1024
+  int size = sock->buf_size
 
   sock->incoming = 1; /* TCP sockets are duplex'ed */
 
 
   sock->incoming = 1; /* TCP sockets are duplex'ed */
 
@@ -113,7 +113,7 @@ static inline void gras_trp_sock_socket_client(gras_trp_plugin_t ignored,
  */
 static inline void gras_trp_sock_socket_server(gras_trp_plugin_t ignored,
                                               gras_socket_t sock){
  */
 static inline void gras_trp_sock_socket_server(gras_trp_plugin_t ignored,
                                               gras_socket_t sock){
-  int size = sock->bufSize * 1024
+  int size = sock->buf_size
   int on = 1;
   struct sockaddr_in server;
 
   int on = 1;
   struct sockaddr_in server;
 
@@ -179,8 +179,8 @@ static gras_socket_t gras_trp_sock_socket_accept(gras_socket_t sock) {
     THROW1(system_error,0,"setsockopt failed, cannot condition the socket: %s",
           sock_errstr);
 
     THROW1(system_error,0,"setsockopt failed, cannot condition the socket: %s",
           sock_errstr);
 
-  res->bufSize = sock->bufSize;
-  size = sock->bufSize * 1024;
+  res->buf_size = sock->buf_size;
+  size = sock->buf_size;
   if (setsockopt(sd, SOL_SOCKET, SO_RCVBUF, (char *)&size, sizeof(size))
       || setsockopt(sd, SOL_SOCKET, SO_SNDBUF, (char *)&size, sizeof(size)))
     WARN1("setsockopt failed, cannot set buffer size: %s", sock_errstr);
   if (setsockopt(sd, SOL_SOCKET, SO_RCVBUF, (char *)&size, sizeof(size))
       || setsockopt(sd, SOL_SOCKET, SO_SNDBUF, (char *)&size, sizeof(size)))
     WARN1("setsockopt failed, cannot set buffer size: %s", sock_errstr);
index ccf3bd9..e3d0691 100644 (file)
@@ -41,7 +41,7 @@ typedef struct s_gras_socket  {
   int accepting :1; /* true if master incoming sock in tcp */
   int meas :1; /* true if this is an experiment socket instead of messaging */
 
   int accepting :1; /* true if master incoming sock in tcp */
   int meas :1; /* true if this is an experiment socket instead of messaging */
 
-  unsigned long int bufSize; /* what to say to the OS. field here to remember it when accepting */
+  unsigned long int buf_size; /* what to say to the OS. field here to remember it when accepting */
    
   int  sd; 
   int  port; /* port on this side */
    
   int  sd; 
   int  port; /* port on this side */