rdv_client : sock_data->rdv_server, sock_data->comm_recv);
- /* The following assert fails in some valid conditions, we need to
+ /* If the following assert fails in some valid conditions, we need to
* change the code downward looking for the socket again.
*
* For now it relies on the facts (A) that sockets and comms are aligned
/*initialize gras message */
msg = xbt_new(s_gras_msg_t, 1);
+ sock->refcount++;
msg->expe = sock;
msg->kind = kind;
msg->type = msgtype;
sock->valid = 1;
sock->moredata = 0;
+ sock->refcount = 1;
sock->sd = -1;
sock->data = NULL;
/** \brief Close socket */
void gras_socket_close(gras_socket_t sock)
{
+ if (--sock->refcount)
+ return;
+
xbt_dynar_t sockets =
((gras_trp_procdata_t)
gras_libdata_by_id(gras_trp_libdata_id))->sockets;
const char *gras_socket_peer_name(gras_socket_t sock)
{
+ xbt_assert(sock->plugin);
return (*sock->plugin->peer_name)(sock);
}
int recvd:1; /* true if the recvd_val field contains one byte of the stream (that we peek'ed to check the socket validity) */
char recvd_val; /* what we peeked from the socket, if any */
+ int refcount; /* refcounting on shared sockets */
+
unsigned long int buf_size; /* what to say to the OS.
Field here to remember it when accepting */