[Dfsm-devel] dFSM/src/libdfsm sm_lists.cpp,1.6,1.7 sm_route_table.cpp,1.11,1.12 sm_seq.cpp,1.5,1.6 t
Status: Beta
Brought to you by:
amoreno
|
From: Andreu M. <am...@us...> - 2004-04-05 06:32:33
|
Update of /cvsroot/dfsm/dFSM/src/libdfsm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9140/src/libdfsm Modified Files: sm_lists.cpp sm_route_table.cpp sm_seq.cpp tinput.cpp Log Message: Bug cleaning due to inadequate shared segment initialization Index: sm_lists.cpp =================================================================== RCS file: /cvsroot/dfsm/dFSM/src/libdfsm/sm_lists.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** sm_lists.cpp 19 Mar 2004 21:05:09 -0000 1.6 --- sm_lists.cpp 5 Apr 2004 06:19:57 -0000 1.7 *************** *** 30,33 **** --- 30,36 ---- * $Revision$ * $Log$ + * Revision 1.7 2004/04/05 06:19:57 amoreno + * Bug cleaning due to inadequate shared segment initialization + * * Revision 1.6 2004/03/19 21:05:09 jvalduvieco * Prerelease cleanup. *************** *** 77,81 **** key = LISTS_ID_MEMORY_KEY; shared_segment_size = LISTS_TOTAL_SIZE; ! machine = machinep; --- 80,85 ---- key = LISTS_ID_MEMORY_KEY; shared_segment_size = LISTS_TOTAL_SIZE; ! struct shmid_ds buf; ! machine = machinep; *************** *** 92,96 **** } ! if (init && machine == 0) { // If is the first machine, reset to 0 // FIXME: with sockt reutilization, this feature can be dangerous // if a fsm restarts with socket 0 and clean others still runnig fsm's --- 96,102 ---- } ! shmctl(segment_id, IPC_STAT, &buf); ! ! if ((buf.shm_nattch == 1) || (init && machine == 0)) { // If is the first machine, reset to 0 // FIXME: with sockt reutilization, this feature can be dangerous // if a fsm restarts with socket 0 and clean others still runnig fsm's *************** *** 120,125 **** ! if ((init && machine == 0) || (*signature != LISTS_SIGNATURE)) ! // if ((init && machine == 0)) { *signature = LISTS_SIGNATURE; --- 126,130 ---- ! if ((buf.shm_nattch == 1) || (init && machine == 0) || (*signature != LISTS_SIGNATURE)) { *signature = LISTS_SIGNATURE; *************** *** 128,132 **** } ! if ((init && machine == 0)) { --- 133,137 ---- } ! if ((buf.shm_nattch == 1) || (init && machine == 0)) { Index: tinput.cpp =================================================================== RCS file: /cvsroot/dfsm/dFSM/src/libdfsm/tinput.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tinput.cpp 3 Apr 2004 06:32:01 -0000 1.23 --- tinput.cpp 5 Apr 2004 06:19:57 -0000 1.24 *************** *** 30,33 **** --- 30,36 ---- * $Revision$ * $Log$ + * Revision 1.24 2004/04/05 06:19:57 amoreno + * Bug cleaning due to inadequate shared segment initialization + * * Revision 1.23 2004/04/03 06:32:01 amoreno * Add support for manual and automatic state machine identification *************** *** 221,225 **** if(sockfd == -1) { FSMLOG(1) <<"Error creating socket: "<<strerror(errno)<<endl; ! //tInput::unregister_machine((*vns_i)); } // Name the socket, as agreed with the server --- 224,228 ---- if(sockfd == -1) { FSMLOG(1) <<"Error creating socket: "<<strerror(errno)<<endl; ! tInput::unregister_machine((*vns_i)); } // Name the socket, as agreed with the server *************** *** 236,240 **** // Unregister machine (socket), clean exit. FSMLOG(2) <<"Unregistering |"<<address.sun_path<<"|"<<endl; ! //tInput::unregister_machine((*vns_i)); } else --- 239,243 ---- // Unregister machine (socket), clean exit. FSMLOG(2) <<"Unregistering |"<<address.sun_path<<"|"<<endl; ! tInput::unregister_machine((*vns_i)); } else *************** *** 247,251 **** // Unregister machine (socket), clean exit. FSMLOG(2) <<"Error sending: "<<strerror(errno)<<endl; ! //tInput::unregister_machine((*vns_i)); } else --- 250,254 ---- // Unregister machine (socket), clean exit. FSMLOG(2) <<"Error sending: "<<strerror(errno)<<endl; ! tInput::unregister_machine((*vns_i)); } else *************** *** 312,316 **** if(sockfd == -1) { FSMLOG(1) <<"Error creating socket: "<<strerror(errno)<<endl; ! //tInput::unregister_machine(machine); } // Name the socket, as agreed with the server --- 315,319 ---- if(sockfd == -1) { FSMLOG(1) <<"Error creating socket: "<<strerror(errno)<<endl; ! tInput::unregister_machine(machine); } // Name the socket, as agreed with the server *************** *** 326,330 **** // Unregister machine (socket), clean exit. FSMLOG(2) <<"Unregistering |"<<address.sun_path<<"|"<<endl; ! //tInput::unregister_machine(machine); } else --- 329,333 ---- // Unregister machine (socket), clean exit. FSMLOG(2) <<"Unregistering |"<<address.sun_path<<"|"<<endl; ! tInput::unregister_machine(machine); } else *************** *** 337,341 **** // Unregister machine (socket), clean exit. FSMLOG(2) <<"Error sending: "<<strerror(errno)<<endl; ! //tInput::unregister_machine(machine); } else --- 340,344 ---- // Unregister machine (socket), clean exit. FSMLOG(2) <<"Error sending: "<<strerror(errno)<<endl; ! tInput::unregister_machine(machine); } else Index: sm_route_table.cpp =================================================================== RCS file: /cvsroot/dfsm/dFSM/src/libdfsm/sm_route_table.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** sm_route_table.cpp 30 Mar 2004 15:12:31 -0000 1.11 --- sm_route_table.cpp 5 Apr 2004 06:19:57 -0000 1.12 *************** *** 30,33 **** --- 30,36 ---- * $Revision$ * $Log$ + * Revision 1.12 2004/04/05 06:19:57 amoreno + * Bug cleaning due to inadequate shared segment initialization + * * Revision 1.11 2004/03/30 15:12:31 amoreno * Events are now total ordered. Solved bug in using the same semaphore for sm_route_table and sm_seq *************** *** 86,90 **** tsm_route_table::shared_segment_size = (MAX_MACHINE*MAX_MSG)/8; key_t key; ! key = OUR_ID_MEMORY_KEY; --- 89,94 ---- tsm_route_table::shared_segment_size = (MAX_MACHINE*MAX_MSG)/8; key_t key; ! struct shmid_ds buf; ! key = OUR_ID_MEMORY_KEY; *************** *** 105,109 **** } ! if (init && machine == 0) { // If is the first machine, reset to 0 // FIXME: with sockt reutilization, this feature can be dangerous // if a fsm restarts with socket 0 and clean others still runnig fsm's --- 109,115 ---- } ! shmctl(tsm_route_table::segment_id , IPC_STAT, &buf); // To better control shared segment initialization ! ! if ((buf.shm_nattch == 1) || (init && machine == 0)) { // If is the first machine, reset to 0 // FIXME: with sockt reutilization, this feature can be dangerous // if a fsm restarts with socket 0 and clean others still runnig fsm's Index: sm_seq.cpp =================================================================== RCS file: /cvsroot/dfsm/dFSM/src/libdfsm/sm_seq.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sm_seq.cpp 30 Mar 2004 15:12:31 -0000 1.5 --- sm_seq.cpp 5 Apr 2004 06:19:57 -0000 1.6 *************** *** 30,33 **** --- 30,36 ---- * $Revision$ * $Log$ + * Revision 1.6 2004/04/05 06:19:57 amoreno + * Bug cleaning due to inadequate shared segment initialization + * * Revision 1.5 2004/03/30 15:12:31 amoreno * Events are now total ordered. Solved bug in using the same semaphore for sm_route_table and sm_seq *************** *** 55,58 **** --- 58,62 ---- { tsm_seq::shared_segment_size = 0x1; // One page of shm please. + struct shmid_ds buf; key_t key; *************** *** 75,79 **** } ! if (machine == 1) { // If is the first machine, reset to 0 *(tsm_seq::shared_memory) = 0; } --- 79,85 ---- } ! shmctl(tsm_seq::segment_id, IPC_STAT, &buf); // To better control shared segment initialization ! ! if ((buf.shm_nattch == 1) || ( machine == 0)) { // If is the first machine, reset to 0 *(tsm_seq::shared_memory) = 0; } |