Changeset 131:50d1dc19b221 in freeDiameter
- Timestamp:
- Dec 10, 2009, 5:18:59 PM (14 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
freeDiameter/p_ce.c
r130 r131 261 261 262 262 /* Extract information sent by the remote peer and save it in our peer structure */ 263 static int save_remote_CE_info(struct msg * msg, struct fd_peer * peer, char ** error_code )263 static int save_remote_CE_info(struct msg * msg, struct fd_peer * peer, char ** error_code, uint32_t *rc) 264 264 { 265 265 struct avp * avp = NULL; … … 292 292 } 293 293 294 /* We check that the CEA Result-Code is Success, otherwise we disconnect */ 295 if (hdr->avp_value->u32 != ER_DIAMETER_SUCCESS) { 296 TRACE_DEBUG(INFO, "Received CEA with Result-Code %d (expected %d), disconnect", hdr->avp_value->u32, ER_DIAMETER_SUCCESS); 297 return EBADMSG; 298 } 299 294 if (rc) 295 *rc = hdr->avp_value->u32; 300 296 break; 301 297 … … 640 636 { 641 637 char * ec; 638 uint32_t rc = 0; 642 639 TRACE_ENTRY("%p %p", msg, peer); 643 640 CHECK_PARAMS( msg && *msg && CHECK_PEER(peer) ); … … 672 669 673 670 /* Save info from the CEA into the peer */ 674 CHECK_FCT_DO( save_remote_CE_info(*msg, peer, &ec ), goto cleanup );671 CHECK_FCT_DO( save_remote_CE_info(*msg, peer, &ec, &rc), goto cleanup ); 675 672 676 673 /* Dispose of the message, we don't need it anymore */ 677 674 CHECK_FCT_DO( fd_msg_free(*msg), /* continue */ ); 678 675 *msg = NULL; 676 677 /* Check the Result-Code */ 678 switch (rc) { 679 case ER_DIAMETER_SUCCESS: 680 /* No problem, we can continue */ 681 break; 682 683 case ER_DIAMETER_TOO_BUSY: 684 /* Retry later */ 685 TRACE_DEBUG(INFO, "Peer %s replied a CEA with Result-Code AVP DIAMETER_TOO_BUSY, will retry later.", peer->p_hdr.info.pi_diamid); 686 fd_psm_cleanup(peer, 0); 687 fd_psm_next_timeout(peer, 0, 300); 688 return 0; 689 690 case ER_ELECTION_LOST: 691 /* Ok, just wait for a little while for the CER to be processed on the other connection. */ 692 TRACE_DEBUG(FULL, "Peer %s replied a CEA with Result-Code AVP ELECTION_LOST, waiting for events.", peer->p_hdr.info.pi_diamid); 693 return 0; 694 695 default: 696 /* In any other case, we abort all attempts to connect to this peer */ 697 TRACE_DEBUG(INFO, "Peer %s replied a CEA with Result-Code AVP %d, aborting connection attempts.", peer->p_hdr.info.pi_diamid, rc); 698 return EINVAL; 699 } 679 700 680 701 /* Handshake if needed, start clear otherwise */ … … 713 734 714 735 cleanup: 715 if (*msg) {716 CHECK_FCT_DO( fd_msg_free(*msg), /* continue */ );717 *msg = NULL;718 }719 720 736 fd_p_ce_clear_cnx(peer, NULL); 721 737 … … 741 757 742 758 /* Parse the content of the received CER */ 743 CHECK_FCT_DO( save_remote_CE_info(msg, peer, &ec ), goto error_abort );759 CHECK_FCT_DO( save_remote_CE_info(msg, peer, &ec, NULL), goto error_abort ); 744 760 745 761 /* Validate the peer if needed */ -
freeDiameter/p_psm.c
r129 r131 532 532 break; 533 533 534 case STATE_WAITCEA: 534 535 case STATE_OPEN: 535 536 case STATE_REOPEN: 536 537 case STATE_WAITCNXACK: 537 case STATE_WAITCEA:538 538 case STATE_SUSPECT: 539 539 default: -
include/freeDiameter/libfreeDiameter.h
r124 r131 1383 1383 #define ER_DIAMETER_TOO_BUSY 3004 1384 1384 #define ER_DIAMETER_REDIRECT_INDICATION 3006 1385 #define ER_ELECTION_LOST 4003 1385 1386 1386 1387
Note: See TracChangeset
for help on using the changeset viewer.