-/* $Id$ */
-
/* messaging - Function related to messaging code specific to RL */
-/* Copyright (c) 2003-2005 Martin Quinson. All rights reserved. */
+/* Copyright (c) 2005, 2006, 2007, 2009, 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. */
XBT_LOG_EXTERNAL_CATEGORY(gras_msg);
XBT_LOG_DEFAULT_CATEGORY(gras_msg);
+void gras_msg_recv(gras_socket_t sock, gras_msg_t msg);
+
+gras_msg_t gras_msg_recv_any(void)
+{
+ gras_msg_t msg = xbt_new0(s_gras_msg_t, 1);
+ msg->expe = gras_trp_select(-1);
+ DEBUG0("Select returned something");
+ gras_msg_recv(msg->expe, msg);
+ return msg;
+}
+
void gras_msg_send_ext(gras_socket_t sock,
e_gras_msg_kind_t kind,
unsigned long int ID,
msg->kind = (e_gras_msg_kind_t) c_kind;
}
CATCH(e) {
- RETHROW0("Exception caught while trying to get the mesage header: %s");
+ RETHROW0
+ ("Exception caught while trying to get the message header: %s");
}
for (cpt = 0; cpt < 4; cpt++)
gras_datadesc_recv(sock, string_type, r_arch, &msg_name);
DEBUG4
- ("Handle an incoming message '%s' (%s) using protocol %d (remote is %s)",
- msg_name, e_gras_msg_kind_names[msg->kind], (int) header[4],
- gras_datadesc_arch_name(r_arch));
+ ("Handle an incoming message '%s' (%s) using protocol %d (remote is %s)",
+ msg_name, e_gras_msg_kind_names[msg->kind], (int) header[4],
+ gras_datadesc_arch_name(r_arch));
TRY {
msg->type =
- (gras_msgtype_t) xbt_set_get_by_name(_gras_msgtype_set, msg_name);
+ (gras_msgtype_t) xbt_set_get_by_name(_gras_msgtype_set, msg_name);
} CATCH(e) {
/* FIXME: Survive unknown messages */
if (e.category == not_found_error) {
msg_name);
} else
RETHROW1
- ("Exception caught while retrieving the type associated to messages '%s' : %s",
- msg_name);
+ ("Exception caught while retrieving the type associated to messages '%s' : %s",
+ msg_name);
}
free(msg_name);