- /* searches for a free port on this host */
- local_hd = (gras_hostdata_t *)SIMIX_host_get_data(SIMIX_host_self());
- for (i=1;i<65536;i++) {
- if (local_hd->cond_port[i] == NULL)
- break;
- }
- if (i == 65536) THROW0(system_error,0,"No port free");
- sock->port = i;
- local_hd->cond_port[i] = SIMIX_cond_init();
- local_hd->mutex_port[i] = SIMIX_mutex_init();
+ /* initialize mutex and condition of the socket */
+ data->mutex = SIMIX_mutex_init();
+ data->cond = SIMIX_cond_init();
+ data->to_socket = pr.socket;