A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update Doc.
[simgrid.git]
/
doc
/
gtut-files
/
06-logs.c
diff --git
a/doc/gtut-files/06-logs.c
b/doc/gtut-files/06-logs.c
index
1fff408
..
f0acfb7
100644
(file)
--- a/
doc/gtut-files/06-logs.c
+++ b/
doc/gtut-files/06-logs.c
@@
-1,3
+1,9
@@
+/* Copyright (c) 2006, 2007, 2010. The SimGrid Team.
+ * All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
#include <gras.h>
XBT_LOG_NEW_DEFAULT_CATEGORY(test,"My little example");
#include <gras.h>
XBT_LOG_NEW_DEFAULT_CATEGORY(test,"My little example");
@@
-16,7
+22,7
@@
int server_kill_cb(gras_msg_cb_ctx_t ctx, void *payload) {
globals->killed = 1;
globals->killed = 1;
- return
1
;
+ return
0
;
} /* end_of_kill_callback */
int server_hello_cb(gras_msg_cb_ctx_t ctx, void *payload) {
} /* end_of_kill_callback */
int server_hello_cb(gras_msg_cb_ctx_t ctx, void *payload) {
@@
-25,7
+31,7
@@
int server_hello_cb(gras_msg_cb_ctx_t ctx, void *payload) {
INFO2("Cool, we received the message from %s:%d.",
gras_socket_peer_name(client), gras_socket_peer_port(client));
INFO2("Cool, we received the message from %s:%d.",
gras_socket_peer_name(client), gras_socket_peer_port(client));
- return
1
;
+ return
0
;
} /* end_of_hello_callback */
int server(int argc, char *argv[]) {
} /* end_of_hello_callback */
int server(int argc, char *argv[]) {
@@
-41,8
+47,8
@@
int server(int argc, char *argv[]) {
gras_msgtype_declare("kill", NULL);
mysock = gras_socket_server(atoi(argv[1]));
gras_msgtype_declare("kill", NULL);
mysock = gras_socket_server(atoi(argv[1]));
- gras_cb_register(
gras_msgtype_by_name("hello")
,&server_hello_cb);
- gras_cb_register(
gras_msgtype_by_name("kill")
,&server_kill_cb);
+ gras_cb_register(
"hello"
,&server_hello_cb);
+ gras_cb_register(
"kill"
,&server_kill_cb);
while (!globals->killed) {
gras_msg_handle(-1); /* blocking */
while (!globals->killed) {
gras_msg_handle(-1); /* blocking */
@@
-67,13
+73,13
@@
int client(int argc, char *argv[]) {
gras_os_sleep(1.5); /* sleep 1 second and half */
toserver = gras_socket_client(argv[1], atoi(argv[2]));
gras_os_sleep(1.5); /* sleep 1 second and half */
toserver = gras_socket_client(argv[1], atoi(argv[2]));
- gras_msg_send(toserver,
gras_msgtype_by_name("hello")
, NULL);
+ gras_msg_send(toserver,
"hello"
, NULL);
INFO1("we sent the data to the server on %s. Let's do it again for fun", gras_socket_peer_name(toserver));
INFO1("we sent the data to the server on %s. Let's do it again for fun", gras_socket_peer_name(toserver));
- gras_msg_send(toserver,
gras_msgtype_by_name("hello")
, NULL);
+ gras_msg_send(toserver,
"hello"
, NULL);
INFO0("Ok. Enough. Have a rest, and then kill the server");
gras_os_sleep(5); /* sleep 1 second and half */
INFO0("Ok. Enough. Have a rest, and then kill the server");
gras_os_sleep(5); /* sleep 1 second and half */
- gras_msg_send(toserver,
gras_msgtype_by_name("kill")
, NULL);
+ gras_msg_send(toserver,
"kill"
, NULL);
gras_exit();
return 0;
gras_exit();
return 0;