From efcb94376a2fae87fc61c4d56ec1e6a0750a2a4d Mon Sep 17 00:00:00 2001 From: mquinson Date: Fri, 17 Mar 2006 20:10:31 +0000 Subject: [PATCH] Put the pseudo-headers in the source file directly since nothing will need them beside chord.c and since it breaks the vpath building mecanism git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1952 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- examples/gras/p2p/chord/chord.c | 61 ++++++++++++++++++++++++++++++- examples/gras/p2p/chord/chord.h | 64 --------------------------------- 2 files changed, 60 insertions(+), 65 deletions(-) delete mode 100644 examples/gras/p2p/chord/chord.h diff --git a/examples/gras/p2p/chord/chord.c b/examples/gras/p2p/chord/chord.c index b74944e071..3042c2fbe3 100644 --- a/examples/gras/p2p/chord/chord.c +++ b/examples/gras/p2p/chord/chord.c @@ -2,13 +2,69 @@ * vim:ts=2:sw=2:noexpandtab */ -#include "chord.h" +#include "xbt/sysdep.h" +#include "gras.h" static int closest_preceding_node(int id); static void check_predecessor(void); XBT_LOG_NEW_DEFAULT_CATEGORY(chord,"Messages specific to this example"); +typedef enum msg_typus{ + PING, + PONG, + GET_PRE, + REP_PRE, + GET_SUC, + REP_SUC, + STD, +}msg_typus; + +/*GRAS_DEFINE_TYPE(s_pbio, + struct s_pbio{ + msg_typus type; + int dest; + char msg[1024]; + }; +); +typedef struct s_pbio pbio_t;*/ + +//GRAS_DEFINE_TYPE(s_ping, + struct s_ping{ + int id; + }; +//); +typedef struct s_ping ping_t; + +//GRAS_DEFINE_TYPE(s_pong, + struct s_pong{ + int id; + int failed; + }; +//); +typedef struct s_pong pong_t; + +GRAS_DEFINE_TYPE(s_get_suc, + struct s_get_suc{ + int id; + }; +); +typedef struct s_get_suc get_suc_t; + +GRAS_DEFINE_TYPE(s_rep_suc, + struct s_rep_suc{ + int id; + char host[1024]; + int port; + }; +); +typedef struct s_rep_suc rep_suc_t; + +typedef struct finger_elem{ + int id; + char host[1024]; + int port; +}finger_elem; @@ -149,6 +205,9 @@ int node(int argc,char **argv){ /* 1. Init the GRAS infrastructure and declare my globals */ gras_init(&argc,argv); + + gras_os_sleep((15-gras_os_getpid())*20); + globals=gras_userdata_new(node_data_t); globals->id=atoi(argv[1]); diff --git a/examples/gras/p2p/chord/chord.h b/examples/gras/p2p/chord/chord.h deleted file mode 100644 index ede9e912bb..0000000000 --- a/examples/gras/p2p/chord/chord.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * vim:ts=2:sw=2:noexpandtab - */ - -#include "xbt/sysdep.h" -#include "gras.h" - - - -typedef enum msg_typus{ - PING, - PONG, - GET_PRE, - REP_PRE, - GET_SUC, - REP_SUC, - STD, -}msg_typus; - -/*GRAS_DEFINE_TYPE(s_pbio, - struct s_pbio{ - msg_typus type; - int dest; - char msg[1024]; - }; -); -typedef struct s_pbio pbio_t;*/ - -//GRAS_DEFINE_TYPE(s_ping, - struct s_ping{ - int id; - }; -//); -typedef struct s_ping ping_t; - -//GRAS_DEFINE_TYPE(s_pong, - struct s_pong{ - int id; - int failed; - }; -//); -typedef struct s_pong pong_t; - -GRAS_DEFINE_TYPE(s_get_suc, - struct s_get_suc{ - int id; - }; -); -typedef struct s_get_suc get_suc_t; - -GRAS_DEFINE_TYPE(s_rep_suc, - struct s_rep_suc{ - int id; - char host[1024]; - int port; - }; -); -typedef struct s_rep_suc rep_suc_t; - -typedef struct finger_elem{ - int id; - char host[1024]; - int port; -}finger_elem; -- 2.20.1