Mercurial > hg > freeDiameter
comparison freeDiameter/p_ce.c @ 454:f1484823cb4a
Small hack which might spear some concurrency problems and is quite harmless
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Thu, 29 Jul 2010 16:11:12 +0900 |
parents | 26aafbbc1640 |
children |
comparison
equal
deleted
inserted
replaced
453:9a8b3178a7a7 | 454:f1484823cb4a |
---|---|
610 /* Send CER on the new connection */ | 610 /* Send CER on the new connection */ |
611 CHECK_FCT( create_CER(peer, initiator, &cer) ); | 611 CHECK_FCT( create_CER(peer, initiator, &cer) ); |
612 CHECK_FCT( fd_out_send(&cer, initiator, peer, FD_CNX_ORDERED) ); | 612 CHECK_FCT( fd_out_send(&cer, initiator, peer, FD_CNX_ORDERED) ); |
613 | 613 |
614 /* Are we doing an election ? */ | 614 /* Are we doing an election ? */ |
615 fd_cpu_flush_cache(); | |
615 if (peer->p_hdr.info.runtime.pir_state == STATE_WAITCNXACK_ELEC) { | 616 if (peer->p_hdr.info.runtime.pir_state == STATE_WAITCNXACK_ELEC) { |
616 if (election_result(peer)) { | 617 if (election_result(peer)) { |
617 /* Close initiator connection */ | 618 /* Close initiator connection */ |
618 fd_cnx_destroy(initiator); | 619 fd_cnx_destroy(initiator); |
619 | 620 |
658 /* msg now contains an answer message to send back */ | 659 /* msg now contains an answer message to send back */ |
659 CHECK_FCT_DO( fd_out_send(msg, NULL, peer, FD_CNX_ORDERED), /* In case of error the message has already been dumped */ ); | 660 CHECK_FCT_DO( fd_out_send(msg, NULL, peer, FD_CNX_ORDERED), /* In case of error the message has already been dumped */ ); |
660 } | 661 } |
661 | 662 |
662 /* If the state is not WAITCEA, just discard the message */ | 663 /* If the state is not WAITCEA, just discard the message */ |
664 fd_cpu_flush_cache(); | |
663 if (req || (peer->p_hdr.info.runtime.pir_state != STATE_WAITCEA)) { | 665 if (req || (peer->p_hdr.info.runtime.pir_state != STATE_WAITCEA)) { |
664 if (*msg) { | 666 if (*msg) { |
665 fd_log_debug("Received CER/CEA message while in state '%s', discarded.\n", STATE_STR(peer->p_hdr.info.runtime.pir_state)); | 667 fd_log_debug("Received CER/CEA message while in state '%s', discarded.\n", STATE_STR(peer->p_hdr.info.runtime.pir_state)); |
666 fd_msg_dump_walk(NONE, *msg); | 668 fd_msg_dump_walk(NONE, *msg); |
667 CHECK_FCT_DO( fd_msg_free(*msg), /* continue */); | 669 CHECK_FCT_DO( fd_msg_free(*msg), /* continue */); |
919 } | 921 } |
920 | 922 |
921 /* We have received a CER on a new connection for this peer */ | 923 /* We have received a CER on a new connection for this peer */ |
922 int fd_p_ce_handle_newCER(struct msg ** msg, struct fd_peer * peer, struct cnxctx ** cnx, int valid) | 924 int fd_p_ce_handle_newCER(struct msg ** msg, struct fd_peer * peer, struct cnxctx ** cnx, int valid) |
923 { | 925 { |
926 fd_cpu_flush_cache(); | |
924 switch (peer->p_hdr.info.runtime.pir_state) { | 927 switch (peer->p_hdr.info.runtime.pir_state) { |
925 case STATE_CLOSED: | 928 case STATE_CLOSED: |
926 peer->p_receiver = *cnx; | 929 peer->p_receiver = *cnx; |
927 *cnx = NULL; | 930 *cnx = NULL; |
928 peer->p_cer = *msg; | 931 peer->p_cer = *msg; |