Navigation


Changeset 706:4ffbc9f1e922 in freeDiameter for libfdcore/p_cnx.c


Ignore:
Timestamp:
Feb 9, 2011, 3:26:58 PM (13 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Large UNTESTED commit with the following changes:

  • Improved DiameterIdentity? handling (esp. interationalization issues), and improve efficiency of some string operations in peers, sessions, and dictionary modules (closes #7)
  • Cleanup in the session module to free only unreferenced sessions (#16)
  • Removed fd_cpu_flush_cache(), replaced by more robust alternatives.
  • Improved peer state machine algorithm to counter SCTP multistream race condition.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/p_cnx.c

    r691 r706  
    3636#include "fdcore-internal.h"
    3737
     38
     39/* TODO: change the behavior to handle properly forced ordering at beginning & end of OPEN state */
     40
    3841/* This file contains code used by a peer state machine to initiate a connection to remote peer */
    3942
     
    8790                ret = getaddrinfo(peer->p_hdr.info.pi_diamid, NULL, &hints, &ai);
    8891                if (ret) {
    89                         fd_log_debug("Unable to resolve address for peer '%s' (%s), aborting\n", peer->p_hdr.info.pi_diamid, gai_strerror(ret));
     92                        TRACE_DEBUG(INFO, "Unable to resolve address for peer '%s' (%s), aborting\n", peer->p_hdr.info.pi_diamid, gai_strerror(ret));
    9093                        if (ret != EAI_AGAIN)
    9194                                fd_psm_terminate( peer, NULL );
     
    123126        /* Now check we have at least one address to attempt */
    124127        if (FD_IS_LIST_EMPTY(&peer->p_hdr.info.pi_endpoints)) {
    125                 fd_log_debug("No address %savailable to connect to peer '%s', aborting\n", peer->p_hdr.info.config.pic_flags.pro3 ? "in the configured family " : "", peer->p_hdr.info.pi_diamid);
     128                TRACE_DEBUG(INFO, "No address %savailable to connect to peer '%s', aborting\n",
     129                                        peer->p_hdr.info.config.pic_flags.pro3 ? "in the configured family " : "", peer->p_hdr.info.pi_diamid);
    126130                fd_psm_terminate( peer, NULL );
    127131                return 0;
     
    219223        {
    220224                char buf[48];
    221                 sprintf(buf, "ConnTo:%.*s", (int)(sizeof(buf)) - 8, peer->p_hdr.info.pi_diamid);
     225                snprintf(buf, sizeof(buf), "ConnTo:%s", peer->p_hdr.info.pi_diamid);
    222226                fd_log_threadname ( buf );
    223227        }
     
    247251#ifndef DISABLE_SCTP                   
    248252                        case IPPROTO_SCTP:
    249                                 cnx = fd_cnx_cli_connect_sctp((peer->p_hdr.info.config.pic_flags.pro3 == PI_P3_IP) ?: fd_g_config->cnf_flags.no_ip6, nc->port, &peer->p_hdr.info.pi_endpoints);
     253                                cnx = fd_cnx_cli_connect_sctp((peer->p_hdr.info.config.pic_flags.pro3 == PI_P3_IP) ?: fd_g_config->cnf_flags.no_ip6,
     254                                                        nc->port, &peer->p_hdr.info.pi_endpoints);
    250255                                break;
    251256#endif /* DISABLE_SCTP */
     
    260265                pthread_testcancel();
    261266               
    262         } while (!cnx); /* and until cancellation */
     267        } while (!cnx); /* and until cancellation or all addresses attempted without success */
    263268       
    264269        /* Now, we have an established connection in cnx */
     
    274279                        {
    275280                                /* Handshake failed ...  */
    276                                 fd_log_debug("TLS Handshake failed with peer '%s', resetting the connection\n", peer->p_hdr.info.pi_diamid);
     281                                TRACE_DEBUG(INFO, "TLS Handshake failed with peer '%s', resetting the connection\n", peer->p_hdr.info.pi_diamid);
    277282                                fd_cnx_destroy(cnx);
    278283                                empty_connection_list(peer);
Note: See TracChangeset for help on using the changeset viewer.