From 1a5f261c83a880a5916e4f06d125ba8abef0fbcf Mon Sep 17 00:00:00 2001 From: mquinson Date: Sun, 8 Aug 2004 04:31:11 +0000 Subject: [PATCH] Introduce the flush, use the buffered transport git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@362 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/gras/Transport/transport.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/gras/Transport/transport.c b/src/gras/Transport/transport.c index 13b466e271..cb207eb5da 100644 --- a/src/gras/Transport/transport.c +++ b/src/gras/Transport/transport.c @@ -71,6 +71,9 @@ gras_trp_init(void){ TRY(gras_trp_plugin_new("file",gras_trp_file_setup)); TRY(gras_trp_plugin_new("sg",gras_trp_sg_setup)); + /* buf is composed, so it must come after the others */ + TRY(gras_trp_plugin_new("buf", gras_trp_buf_setup)); + return no_error; } @@ -147,8 +150,7 @@ gras_socket_server(unsigned short port, *dst = NULL; DEBUG1("Create a server socket from plugin %s",gras_if_RL() ? "tcp" : "sg"); - TRY(gras_trp_plugin_get_by_name(gras_if_RL() ? "tcp" : "sg", - &trp)); + TRY(gras_trp_plugin_get_by_name("buf",&trp)); /* defaults settings */ TRY(gras_trp_socket_new(1,&sock)); @@ -189,8 +191,7 @@ gras_socket_client(const char *host, *dst = NULL; - TRY(gras_trp_plugin_get_by_name(gras_if_RL() ? "tcp" : "sg", - &trp)); + TRY(gras_trp_plugin_get_by_name("buf",&trp)); DEBUG1("Create a client socket from plugin %s",gras_if_RL() ? "tcp" : "sg"); /* defaults settings */ @@ -200,9 +201,9 @@ gras_socket_client(const char *host, sock->peer_name = strdup(host?host:"localhost"); /* plugin-specific */ - errcode= (* trp->socket_client)(trp, - host ? host : "localhost", port, - sock); + errcode= (*trp->socket_client)(trp, + host ? host : "localhost", port, + sock); DEBUG3("in=%c out=%c accept=%c", sock->incoming?'y':'n', sock->outgoing?'y':'n', @@ -276,6 +277,15 @@ gras_trp_chunk_recv(gras_socket_t *sd, return (sd->plugin->chunk_recv)(sd,data,size); } +/** + * gras_trp_flush: + * + * Make sure all pending communications are done + */ +gras_error_t +gras_trp_flush(gras_socket_t *sd) { + return (sd->plugin->flush)(sd); +} gras_error_t gras_trp_plugin_get_by_name(const char *name, -- 2.20.1