From: mquinson Date: Mon, 3 Apr 2006 13:27:47 +0000 (+0000) Subject: Sizes in bytes; rework the documentation; uniformize the variable naming schema X-Git-Tag: v3.3~3304 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/55b561cd6f62870d48e715a653fa7230da9fd25a?ds=sidebyside Sizes in bytes; rework the documentation; uniformize the variable naming schema git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2054 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/gras/Transport/transport.c b/src/gras/Transport/transport.c index e9869ab4d0..bd52f0c523 100644 --- a/src/gras/Transport/transport.c +++ b/src/gras/Transport/transport.c @@ -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, - unsigned long int bufSize, + unsigned long int buf_size, 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; - sock->bufSize = bufSize; + sock->buf_size = buf_size>0 ? buf_size : 32*1024; 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, - unsigned long int bufSize, + unsigned long int buf_size, 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->bufSize = bufSize; + sock->buf_size = buf_size>0 ? buf_size: 32*1024; sock->meas = measurement; /* plugin-specific */ diff --git a/src/gras/Transport/transport_plugin_tcp.c b/src/gras/Transport/transport_plugin_tcp.c index 06609af3a9..b360df0b07 100644 --- a/src/gras/Transport/transport_plugin_tcp.c +++ b/src/gras/Transport/transport_plugin_tcp.c @@ -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; - int size = sock->bufSize * 1024; + int size = sock->buf_size; 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){ - int size = sock->bufSize * 1024; + int size = sock->buf_size; 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); - 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); diff --git a/src/gras/Transport/transport_private.h b/src/gras/Transport/transport_private.h index ccf3bd9514..e3d06918b7 100644 --- a/src/gras/Transport/transport_private.h +++ b/src/gras/Transport/transport_private.h @@ -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 */ - 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 */