comparison freeDiameter/p_psm.c @ 74:9dcb1bd11a07

Some cleanups
author Sebastien Decugis <sdecugis@nict.go.jp>
date Tue, 01 Dec 2009 14:14:34 +0900
parents 65b32c93f21e
children 42bd29c4128b
comparison
equal deleted inserted replaced
73:02db4d794ccf 74:9dcb1bd11a07
233 } 233 }
234 } 234 }
235 235
236 peer->p_psm_timer.tv_sec += delay; 236 peer->p_psm_timer.tv_sec += delay;
237 237
238 TRACE_DEBUG(FULL, "Peer timeout reset to %d seconds%s", delay, add_random ? " (+/- 2)", "" );
239
238 #ifdef SLOW_PSM 240 #ifdef SLOW_PSM
239 /* temporary for debug */ 241 /* temporary for debug */
240 peer->p_psm_timer.tv_sec += 10; 242 peer->p_psm_timer.tv_sec += 10;
241 #endif 243 #endif
242 } 244 }
243 245
244 /* Cleanup the peer */ 246 /* Cleanup the peer */
245 void fd_psm_cleanup(struct fd_peer * peer, int terminate) 247 void fd_psm_cleanup(struct fd_peer * peer, int terminate)
246 { 248 {
247 /* Move to CLOSED state: failover messages, stop OUT thread, unlink peer from active list */ 249 /* Move to CLOSED state: failover messages, stop OUT thread, unlink peer from active list */
248 CHECK_FCT_DO( fd_psm_change_state(peer, STATE_CLOSED), /* continue */ ); 250 if (peer->p_hdr.info.runtime.pir_state != STATE_ZOMBIE) {
251 CHECK_FCT_DO( fd_psm_change_state(peer, STATE_CLOSED), /* continue */ );
252 }
249 253
250 fd_p_cnx_abort(peer, terminate); 254 fd_p_cnx_abort(peer, terminate);
251 255
252 fd_p_ce_clear_cnx(peer, NULL); 256 fd_p_ce_clear_cnx(peer, NULL);
253 257
511 515
512 /* The connection object is broken */ 516 /* The connection object is broken */
513 if (event == FDEVP_CNX_ERROR) { 517 if (event == FDEVP_CNX_ERROR) {
514 switch (peer->p_hdr.info.runtime.pir_state) { 518 switch (peer->p_hdr.info.runtime.pir_state) {
515 case STATE_WAITCNXACK_ELEC: 519 case STATE_WAITCNXACK_ELEC:
516 TODO("Reply CEA on the receiver side and go to OPEN state"); 520 /* Abort the initiating side */
517 goto psm_loop; 521 fd_p_cnx_abort(peer, 0);
522 /* Process the receiver side */
523 CHECK_FCT_DO( fd_p_ce_process_receiver(peer), goto psm_end );
524 break;
518 525
519 case STATE_OPEN: 526 case STATE_OPEN:
520 case STATE_REOPEN: 527 case STATE_REOPEN:
521 case STATE_WAITCNXACK: 528 case STATE_WAITCNXACK:
522 case STATE_WAITCEA: 529 case STATE_WAITCEA:
531 538
532 /* Reset the timer */ 539 /* Reset the timer */
533 fd_psm_next_timeout(peer, 1, peer->p_hdr.info.config.pic_tctimer ?: fd_g_config->cnf_timer_tc); 540 fd_psm_next_timeout(peer, 1, peer->p_hdr.info.config.pic_tctimer ?: fd_g_config->cnf_timer_tc);
534 541
535 case STATE_CLOSED: 542 case STATE_CLOSED:
536 /* Go to the next event */ 543 /* Just ignore */
537 goto psm_loop; 544 ;
538 } 545 }
546 goto psm_loop;
539 } 547 }
540 548
541 /* The connection notified a change in endpoints */ 549 /* The connection notified a change in endpoints */
542 if (event == FDEVP_CNX_EP_CHANGE) { 550 if (event == FDEVP_CNX_EP_CHANGE) {
543 /* We actually don't care if we are in OPEN state here... */ 551 /* We actually don't care if we are in OPEN state here... */
"Welcome to our mercurial repository"