Navigation


Changeset 1379:9f52a841b0c7 in freeDiameter for libfdcore


Ignore:
Timestamp:
Jun 20, 2019, 7:07:56 PM (5 years ago)
Author:
Thomas Klausner <tk@giga.or.at>
Branch:
default
Phase:
public
Message:

Fix typos in comments and remove trailing whitespace.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/p_psm.c

    r1330 r1379  
    4141 - the state machine described in rfc3539#section-3.4
    4242 - the following observations.
    43  
     43
    4444The delivery of Diameter messages must not always be unordered: order is important at
    45 begining and end of a connection lifetime. It means we need agility to
     45beginning and end of a connection lifetime. It means we need agility to
    4646switch between "ordering enforced" and "ordering not enforced to counter
    4747Head of the Line Blocking" modes of operation.
     
    5050incomplete, because it lacks the SUSPECT state and the 3 DWR/DWA
    5151exchanges (section 5.1) when the peer recovers from this state.
    52 Personnally I don't see the rationale for exchanging 3 messages (why 3?)
     52Personally I don't see the rationale for exchanging 3 messages (why 3?)
    5353but, if we require at least 1 DWR/DWA exchange to be always performed
    5454after the CER/CEA exchange (and initiated by the peer that sent the
     
    9797I really cannot see a way to counter this effect by using the ordering
    9898of the messages, except by applying a timer (state STATE_CLOSING_GRACE).
    99 This timer can be also useful when we detect that some messages has not 
    100 yet received an answer on this link, to give time to the application to 
     99This timer can be also useful when we detect that some messages has not
     100yet received an answer on this link, to give time to the application to
    101101complete the exchange ongoing.
    102102
     
    128128        TRACE_ENTRY("");
    129129        CHECK_POSIX( pthread_mutex_lock(&started_mtx) );
    130 awake: 
     130awake:
    131131        if (!ret && !started) {
    132132                pthread_cleanup_push( fd_cleanup_mutex, &started_mtx );
     
    160160        struct fd_list * li;
    161161        CHECK_PARAMS( FD_IS_LIST_EMPTY(&peer->p_actives) );
    162        
     162
    163163        /* Callback registered by the credential validator (fd_peer_validate_register) */
    164164        if (peer->p_cb2) {
     
    171171                return 0;
    172172        }
    173        
     173
    174174        /* Insert in the active peers list */
    175175        CHECK_POSIX( pthread_rwlock_wrlock(&fd_g_activ_peers_rw) );
    176176        for (li = fd_g_activ_peers.next; li != &fd_g_activ_peers; li = li->next) {
    177177                struct fd_peer * next_p = (struct fd_peer *)li->o;
    178                 int cmp = fd_os_cmp(peer->p_hdr.info.pi_diamid, peer->p_hdr.info.pi_diamidlen, 
     178                int cmp = fd_os_cmp(peer->p_hdr.info.pi_diamid, peer->p_hdr.info.pi_diamidlen,
    179179                                        next_p->p_hdr.info.pi_diamid, next_p->p_hdr.info.pi_diamidlen);
    180180                if (cmp < 0)
     
    183183        fd_list_insert_before(li, &peer->p_actives);
    184184        CHECK_POSIX( pthread_rwlock_unlock(&fd_g_activ_peers_rw) );
    185        
     185
    186186        /* Callback registered when the peer was added, by fd_peer_add */
    187187        if (peer->p_cb) {
     
    191191                peer->p_cb_data = NULL;
    192192        }
    193        
     193
    194194        /* Start the thread to handle outgoing messages */
    195195        CHECK_FCT( fd_out_start(peer) );
    196        
     196
    197197        /* Update the expiry timer now */
    198198        CHECK_FCT( fd_p_expi_update(peer) );
    199        
     199
    200200        return 0;
    201201}
     
    206206        fd_list_unlink( &peer->p_actives );
    207207        CHECK_POSIX( pthread_rwlock_unlock(&fd_g_activ_peers_rw) );
    208        
     208
    209209        /* Stop the "out" thread */
    210210        CHECK_FCT( fd_out_stop(peer) );
    211        
     211
    212212        /* Failover the messages */
    213213        if (!skip_failover) {
    214214                fd_peer_failover_msg(peer);
    215215        }
    216        
     216
    217217        return 0;
    218218}
     
    234234                        }
    235235                        break;
    236                        
     236
    237237                        case FDEVP_TERMINATE:
    238238                                /* Do not free the string since it is a constant */
    239239                        break;
    240                        
     240
    241241                        case FDEVP_CNX_INCOMING: {
    242242                                struct cnx_incoming * evd = ev->data;
     
    256256{
    257257        int ret;
    258        
     258
    259259        struct fd_peer * p = (struct fd_peer *)peer;
    260        
     260
    261261        if (!CHECK_PEER(p))
    262262                return -1;
    263        
     263
    264264        CHECK_POSIX_DO( pthread_mutex_lock(&p->p_state_mtx), return -1 );
    265265        ret = p->p_state;
    266266        CHECK_POSIX_DO( pthread_mutex_unlock(&p->p_state_mtx), return -1 );
    267        
     267
    268268        return ret;
    269269}
     
    274274{
    275275        int old;
    276        
     276
    277277        TRACE_ENTRY("%p %d(%s)", peer, new_state, STATE_STR(new_state));
    278278        CHECK_PARAMS( CHECK_PEER(peer) );
    279        
     279
    280280        old = fd_peer_getstate(peer);
    281281        if (old == new_state)
    282282                return 0;
    283        
     283
    284284        LOG(((old == STATE_OPEN) || (new_state == STATE_OPEN)) ? ((new_state == STATE_SUSPECT || new_state == STATE_CLOSED) ? FD_LOG_ERROR : FD_LOG_NOTICE ): FD_LOG_DEBUG, "'%s'\t-> '%s'\t'%s'",
    285285                        STATE_STR(old),
    286286                        STATE_STR(new_state),
    287287                        peer->p_hdr.info.pi_diamid);
    288        
    289        
     288
     289
    290290        CHECK_POSIX( pthread_mutex_lock(&peer->p_state_mtx) );
    291291        peer->p_state = new_state;
    292292        CHECK_POSIX( pthread_mutex_unlock(&peer->p_state_mtx) );
    293        
     293
    294294        if (old == STATE_OPEN) {
    295295                CHECK_FCT( leave_open_state(peer, new_state == STATE_CLOSING_GRACE) );
     
    302302                CHECK_FCT( enter_open_state(peer) );
    303303        }
    304        
     304
    305305        if (new_state == STATE_CLOSED) {
    306306                /* Purge event list */
    307307                fd_psm_events_free(peer);
    308                
    309                 /* Reset the counter of pending anwers to send */
     308
     309                /* Reset the counter of pending answers to send */
    310310                peer->p_reqin_count = 0;
    311                
    312                 /* If the peer is not persistant, we destroy it */
     311
     312                /* If the peer is not persistent, we destroy it */
    313313                if (peer->p_hdr.info.config.pic_flags.persist == PI_PRST_NONE) {
    314314                        CHECK_FCT( fd_event_send(peer->p_events, FDEVP_TERMINATE, 0, NULL) );
    315315                }
    316316        }
    317        
     317
    318318        return 0;
    319319}
     
    323323{
    324324        TRACE_DEBUG(FULL, "Peer timeout reset to %d seconds%s", delay, add_random ? " (+/- 2)" : "" );
    325        
     325
    326326        /* Initialize the timer */
    327327        CHECK_POSIX_DO(  clock_gettime( CLOCK_REALTIME,  &peer->p_psm_timer ), ASSERT(0) );
    328        
     328
    329329        if (add_random) {
    330330                if (delay > 2)
     
    341341                }
    342342        }
    343        
     343
    344344        peer->p_psm_timer.tv_sec += delay;
    345        
     345
    346346#ifdef SLOW_PSM
    347347        /* temporary for debug */
     
    357357                CHECK_FCT_DO( fd_psm_change_state(peer, STATE_CLOSED), /* continue */ );
    358358        }
    359        
     359
    360360        fd_p_cnx_abort(peer, terminate);
    361        
     361
    362362        fd_p_ce_clear_cnx(peer, NULL);
    363        
     363
    364364        if (peer->p_receiver) {
    365365                fd_cnx_destroy(peer->p_receiver);
    366366                peer->p_receiver = NULL;
    367367        }
    368        
     368
    369369        if (terminate) {
    370370                fd_psm_events_free(peer);
    371371                CHECK_FCT_DO( fd_fifo_del(&peer->p_events), /* continue */ );
    372372        }
    373        
     373
    374374}
    375375
     
    378378/*                      The PSM thread                                  */
    379379/************************************************************************/
    380 /* Cancelation cleanup : set ZOMBIE state in the peer */
    381 void cleanup_setstate(void * arg) 
     380/* Cancellation cleanup : set ZOMBIE state in the peer */
     381void cleanup_setstate(void * arg)
    382382{
    383383        struct fd_peer * peer = (struct fd_peer *)arg;
     
    389389}
    390390
    391 /* The state machine thread (controler) */
     391/* The state machine thread (controller) */
    392392static void * p_psm_th( void * arg )
    393393{
     
    398398        void * ev_data;
    399399        int cur_state;
    400        
     400
    401401        CHECK_PARAMS_DO( CHECK_PEER(peer), ASSERT(0) );
    402        
     402
    403403        pthread_cleanup_push( cleanup_setstate, arg );
    404        
     404
    405405        /* Set the thread name */
    406406        {
     
    409409                fd_log_threadname ( buf );
    410410        }
    411        
     411
    412412        /* The state machine starts in CLOSED state */
    413413        CHECK_POSIX_DO( pthread_mutex_lock(&peer->p_state_mtx), goto psm_end );
     
    417417        /* Wait that the PSM are authorized to start in the daemon */
    418418        CHECK_FCT_DO( fd_psm_waitstart(), goto psm_end );
    419        
     419
    420420        /* Initialize the timer */
    421421        if (peer->p_flags.pf_responder) {
     
    424424                fd_psm_next_timeout(peer, created_started, 0);
    425425        }
    426        
     426
    427427psm_loop:
    428428        /* Get next event */
     
    430430                        peer->p_hdr.info.pi_diamid, STATE_STR(fd_peer_getstate(peer)));
    431431        CHECK_FCT_DO( fd_event_timedget(peer->p_events, &peer->p_psm_timer, FDEVP_PSM_TIMEOUT, &event, &ev_sz, &ev_data), goto psm_end );
    432        
     432
    433433        cur_state = fd_peer_getstate(peer);
    434434        if (cur_state == -1)
    435435                goto psm_end;
    436        
     436
    437437        TRACE_DEBUG(FULL, "'%s'\t<-- '%s'\t(%p,%zd)\t'%s'",
    438438                        STATE_STR(cur_state),
     
    463463                                CHECK_FCT_DO( fd_p_dp_initiate(peer, ev_data), goto psm_end );
    464464                                goto psm_loop;
    465                        
    466                         /*     
     465
     466                        /*
    467467                        case STATE_CLOSING:
    468468                        case STATE_CLOSING_GRACE:
     
    478478                }
    479479        }
    480        
     480
    481481        /* A message was received */
    482482        if (event == FDEVP_CNX_MSG_RECV) {
     
    485485                struct fd_cnx_rcvdata rcv_data;
    486486                struct fd_msg_pmdl * pmdl = NULL;
    487                
     487
    488488                rcv_data.buffer = ev_data;
    489489                rcv_data.length = ev_sz;
    490490                pmdl = fd_msg_pmdl_get_inbuf(rcv_data.buffer, rcv_data.length);
    491                
     491
    492492                /* Parse the received buffer */
    493                 CHECK_FCT_DO( fd_msg_parse_buffer( (void *)&ev_data, ev_sz, &msg), 
     493                CHECK_FCT_DO( fd_msg_parse_buffer( (void *)&ev_data, ev_sz, &msg),
    494494                        {
    495495                                fd_hook_call(HOOK_MESSAGE_PARSING_ERROR, NULL, peer, &rcv_data, pmdl );
     
    498498                                goto psm_loop;
    499499                        } );
    500                        
     500
    501501                fd_hook_associate(msg, pmdl);
    502502                CHECK_FCT_DO( fd_msg_source_set( msg, peer->p_hdr.info.pi_diamid, peer->p_hdr.info.pi_diamidlen), goto psm_end);
    503        
     503
    504504                /* If the current state does not allow receiving messages, just drop it */
    505505                if (cur_state == STATE_CLOSED) {
     
    509509                        goto psm_loop;
    510510                }
    511                
     511
    512512                /* Extract the header */
    513513                CHECK_FCT_DO( fd_msg_hdr(msg, &hdr), goto psm_end );
    514                
     514
    515515                /* If it is an answer, associate with the request or drop */
    516516                if (!(hdr->msg_flags & CMD_FLAG_REQUEST)) {
     
    523523                                goto psm_loop;
    524524                        }
    525                        
     525
    526526                        /* Associate */
    527527                        CHECK_FCT_DO( fd_msg_answ_associate( msg, req ), goto psm_end );
    528                        
    529                 }
    530                
     528
     529                }
     530
    531531                /* Log incoming message */
    532532                fd_hook_call(HOOK_MESSAGE_RECEIVED, msg, peer, NULL, fd_msg_pmdl_get(msg));
    533                
     533
    534534                if (cur_state == STATE_OPEN_NEW) {
    535535                        /* OK, we have received something, so the connection is supposedly now in OPEN state at the remote site */
    536536                        fd_psm_change_state(peer, STATE_OPEN );
    537537                }
    538                
     538
    539539                /* Now handle non-link-local messages */
    540540                if (fd_msg_is_routable(msg)) {
     
    563563                                                CHECK_POSIX_DO( pthread_mutex_unlock(&peer->p_state_mtx), goto psm_end  );
    564564                                        }
    565                                                
     565
    566566                                        /* Requeue to the global incoming queue */
    567567                                        CHECK_FCT_DO(fd_fifo_post(fd_g_incoming, &msg), goto psm_end );
     
    572572                                        }
    573573                                        break;
    574                                        
     574
    575575                                /* In other states, we discard the message, it is either old or invalid to send it for the remote peer */
    576576                                case STATE_WAITCNXACK:
     
    588588                        goto psm_loop;
    589589                }
    590                
     590
    591591                /* Link-local message: They must be understood by our dictionary, otherwise we return an error */
    592592                {
     
    594594                        int ret = fd_msg_parse_or_error( &msg, &error );
    595595                        if (ret != EBADMSG) {
    596                                 CHECK_FCT_DO( ret, 
     596                                CHECK_FCT_DO( ret,
    597597                                        {
    598598                                                char buf[256];
    599                                                 snprintf(buf, sizeof(buf), "%s: An unexpected error occurred while parsing a link-local message", peer->p_hdr.info.pi_diamid); 
     599                                                snprintf(buf, sizeof(buf), "%s: An unexpected error occurred while parsing a link-local message", peer->p_hdr.info.pi_diamid);
    600600                                                fd_hook_call(HOOK_MESSAGE_DROPPED, msg, peer, buf, fd_msg_pmdl_get(msg));
    601                                                 fd_msg_free(msg); 
    602                                                 goto psm_end; 
     601                                                fd_msg_free(msg);
     602                                                goto psm_end;
    603603                                        } );
    604604                        } else {
     
    609609                                                char buf[256];
    610610                                                /* Only if an error occurred & the message was not saved / dumped */
    611                                                 snprintf(buf, sizeof(buf), "%s: error sending a message", peer->p_hdr.info.pi_diamid); 
     611                                                snprintf(buf, sizeof(buf), "%s: error sending a message", peer->p_hdr.info.pi_diamid);
    612612                                                fd_hook_call(HOOK_MESSAGE_DROPPED, error, peer, buf, fd_msg_pmdl_get(error));
    613613                                                CHECK_FCT_DO( fd_msg_free(error), goto psm_end);
     
    624624                        }
    625625                }
    626                
     626
    627627                /* Handle the LL message and update the expiry timer appropriately */
    628628                switch (hdr->msg_code) {
    629629                        case CC_CAPABILITIES_EXCHANGE:
    630                                 CHECK_FCT_DO( fd_p_ce_msgrcv(&msg, (hdr->msg_flags & CMD_FLAG_REQUEST), peer), 
     630                                CHECK_FCT_DO( fd_p_ce_msgrcv(&msg, (hdr->msg_flags & CMD_FLAG_REQUEST), peer),
    631631                                        {
    632632                                                if (msg)
     
    635635                                        } );
    636636                                break;
    637                        
     637
    638638                        case CC_DISCONNECT_PEER:
    639639                                CHECK_FCT_DO( fd_p_dp_handle(&msg, (hdr->msg_flags & CMD_FLAG_REQUEST), peer), goto psm_reset );
     
    642642
    643643                                break;
    644                        
     644
    645645                        case CC_DEVICE_WATCHDOG:
    646646                                CHECK_FCT_DO( fd_p_dw_handle(&msg, (hdr->msg_flags & CMD_FLAG_REQUEST), peer), goto psm_reset );
    647647                                break;
    648                        
     648
    649649                        default:
    650650                                /* Unknown / unexpected / invalid message -- but validated by our dictionary */
     
    665665                                        TRACE_DEBUG(INFO, "Received answer with erroneous 'is_routable' result...");
    666666                                }
    667                                
     667
    668668                                /* Cleanup the message if not done */
    669669                                if (msg) {
     
    675675                                }
    676676                };
    677                
     677
    678678                /* At this point the message must have been fully handled already */
    679679                if (msg) {
     
    683683                        fd_msg_free(msg);
    684684                }
    685                
     685
    686686                goto psm_loop;
    687687        }
    688        
     688
    689689        /* The connection object is broken */
    690690        if (event == FDEVP_CNX_ERROR) {
     
    696696                                CHECK_FCT_DO( fd_p_ce_process_receiver(peer), goto psm_end );
    697697                                break;
    698                        
     698
    699699                        case STATE_WAITCEA:
    700700                        case STATE_OPEN:
     
    706706                                /* Mark the connection problem */
    707707                                peer->p_flags.pf_cnx_pb = 1;
    708                        
     708
    709709                                fd_hook_call(HOOK_PEER_CONNECT_FAILED, NULL, peer, "The connection was broken", NULL);
    710                                
     710
    711711                                /* Destroy the connection, restart the timer to a new connection attempt */
    712712                                fd_psm_next_timeout(peer, 1, peer->p_hdr.info.config.pic_tctimer ?: fd_g_config->cnf_timer_tc);
    713                                
     713
    714714                        case STATE_CLOSED:
    715715                                goto psm_reset;
    716                                
     716
    717717                        case STATE_CLOSING:
    718718                                /* We sent a DPR so we are terminating, do not wait for DPA */
    719719                                goto psm_end;
    720                                
     720
    721721                        case STATE_CLOSING_GRACE:
    722722                                if (peer->p_flags.pf_localterm) /* initiated here */
    723723                                        goto psm_end;
    724                                
     724
    725725                                fd_psm_cleanup(peer, 0);
    726                                
     726
    727727                                /* Reset the timer for next connection attempt */
    728728                                fd_psm_next_timeout(peer, 1, fd_p_dp_newdelay(peer));
     
    731731                goto psm_loop;
    732732        }
    733        
     733
    734734        /* The connection notified a change in endpoints */
    735735        if (event == FDEVP_CNX_EP_CHANGE) {
    736736                /* We actually don't care if we are in OPEN state here... */
    737                
     737
    738738                /* Cleanup the remote LL and primary addresses */
    739739                CHECK_FCT_DO( fd_ep_filter( &peer->p_hdr.info.pi_endpoints, EP_FL_CONF | EP_FL_DISC | EP_FL_ADV ), /* ignore the error */);
    740740                CHECK_FCT_DO( fd_ep_clearflags( &peer->p_hdr.info.pi_endpoints, EP_FL_PRIMARY ), /* ignore the error */);
    741                
     741
    742742                /* Get the new ones */
    743743                CHECK_FCT_DO( fd_cnx_getremoteeps(peer->p_cnxctx, &peer->p_hdr.info.pi_endpoints), /* ignore the error */);
    744                
     744
    745745                /* We do not support local endpoints change currently, but it could be added here if needed (refresh fd_g_config->cnf_endpoints) */
    746746                {
     
    750750                        free(buf);
    751751                }
    752                
     752
    753753                /* Done */
    754754                goto psm_loop;
    755755        }
    756        
     756
    757757        /* A new connection was established and CER containing this peer id was received */
    758758        if (event == FDEVP_CNX_INCOMING) {
    759759                struct cnx_incoming * params = ev_data;
    760760                ASSERT(params);
    761                
     761
    762762                /* Handle the message */
    763763                CHECK_FCT_DO( fd_p_ce_handle_newCER(&params->cer, peer, &params->cnx, params->validate), goto psm_end );
    764                
     764
    765765                /* Cleanup if needed */
    766766                if (params->cnx) {
     
    772772                        params->cer = NULL;
    773773                }
    774                
     774
    775775                /* Loop */
    776776                free(ev_data);
    777777                goto psm_loop;
    778778        }
    779        
     779
    780780        /* A new connection has been established with the remote peer */
    781781        if (event == FDEVP_CNX_ESTABLISHED) {
    782782                struct cnxctx * cnx = ev_data;
    783                
     783
    784784                /* Release the resources of the connecting thread */
    785785                CHECK_POSIX_DO( pthread_join( peer->p_ini_thr, NULL), /* ignore, it is not a big deal */);
    786786                peer->p_ini_thr = (pthread_t)NULL;
    787                
     787
    788788                switch (cur_state) {
    789789                        case STATE_WAITCNXACK_ELEC:
     
    792792                                fd_p_ce_handle_newcnx(peer, cnx);
    793793                                break;
    794                                
     794
    795795                        default:
    796796                                /* Just abort the attempt and continue */
     
    798798                                fd_cnx_destroy(cnx);
    799799                }
    800                
     800
    801801                goto psm_loop;
    802802        }
    803        
     803
    804804        /* A new connection has not been established with the remote peer */
    805805        if (event == FDEVP_CNX_FAILED) {
    806                
     806
    807807                /* Release the resources of the connecting thread */
    808808                CHECK_POSIX_DO( pthread_join( peer->p_ini_thr, NULL), /* ignore, it is not a big deal */);
    809809                peer->p_ini_thr = (pthread_t)NULL;
    810                
     810
    811811                switch (cur_state) {
    812812                        case STATE_WAITCNXACK_ELEC:
     
    816816                                CHECK_FCT_DO( fd_p_ce_process_receiver(peer), goto psm_end );
    817817                                break;
    818                                
     818
    819819                        case STATE_WAITCNXACK:
    820820                                /* Go back to CLOSE */
    821821                                fd_psm_next_timeout(peer, 1, peer->p_hdr.info.config.pic_tctimer ?: fd_g_config->cnf_timer_tc);
    822822                                goto psm_reset;
    823                                
     823
    824824                        default:
    825825                                /* Just ignore */
    826826                                TRACE_DEBUG(FULL, "Connection attempt failed but current state is %s, ignoring...", STATE_STR(cur_state));
    827827                }
    828                
     828
    829829                goto psm_loop;
    830830        }
    831        
     831
    832832        /* The timeout for the current state has been reached */
    833833        if (event == FDEVP_PSM_TIMEOUT) {
     
    838838                                CHECK_FCT_DO( fd_p_dw_timeout(peer), goto psm_end );
    839839                                goto psm_loop;
    840                                
     840
    841841                        case STATE_CLOSED:
    842842                                LOG_D("%s: Connecting...", peer->p_hdr.info.pi_diamid);
     
    845845                                CHECK_FCT_DO( fd_p_cnx_init(peer), goto psm_end );
    846846                                goto psm_loop;
    847                                
     847
    848848                        case STATE_SUSPECT:
    849849                                /* Mark the connection problem */
     
    856856                                fd_psm_next_timeout(peer, 1, peer->p_hdr.info.config.pic_tctimer ?: fd_g_config->cnf_timer_tc);
    857857                                goto psm_reset;
    858                                
     858
    859859                        case STATE_CLOSING_GRACE:
    860860                                /* The grace period is completed, now close */
    861861                                if (peer->p_flags.pf_localterm)
    862862                                        goto psm_end;
    863                                
     863
    864864                                fd_psm_cleanup(peer, 0);
    865865                                /* Reset the timer for next connection attempt */
    866866                                fd_psm_next_timeout(peer, 1, fd_p_dp_newdelay(peer));
    867867                                goto psm_loop;
    868                                
     868
    869869                        case STATE_WAITCNXACK_ELEC:
    870870                                /* Abort the initiating side */
     
    873873                                CHECK_FCT_DO( fd_p_ce_process_receiver(peer), goto psm_end );
    874874                                goto psm_loop;
    875                        
     875
    876876                        default:
    877877                                ASSERT(0); /* implementation problem, we did not foresee this case? */
    878878                }
    879879        }
    880        
     880
    881881        /* Default action : the handling has not yet been implemented. [for debug only] */
    882882        TRACE_DEBUG(INFO, "Missing handler in PSM for '%s'\t<-- '%s'", STATE_STR(cur_state), fd_pev_str(event));
     
    886886        fd_psm_cleanup(peer, 0);
    887887        goto psm_loop;
    888        
     888
    889889psm_end:
    890890        cur_state = fd_peer_getstate(peer);
     
    912912{
    913913        TRACE_ENTRY("%p", peer);
    914        
     914
    915915        /* Check the peer and state are OK */
    916916        CHECK_PARAMS( fd_peer_getstate(peer) == STATE_NEW );
    917        
     917
    918918        /* Create the FIFO for events */
    919919        CHECK_FCT( fd_fifo_new(&peer->p_events, 0) );
    920        
    921         /* Create the PSM controler thread */
     920
     921        /* Create the PSM controller thread */
    922922        CHECK_POSIX( pthread_create( &peer->p_psm, NULL, p_psm_th, peer ) );
    923        
     923
    924924        /* We're done */
    925925        return 0;
     
    931931        TRACE_ENTRY("%p", peer);
    932932        CHECK_PARAMS( CHECK_PEER(peer) );
    933        
     933
    934934        if (fd_peer_getstate(peer) != STATE_ZOMBIE) {
    935935                CHECK_FCT( fd_event_send(peer->p_events, FDEVP_TERMINATE, 0, reason) );
     
    944944{
    945945        TRACE_ENTRY("%p", peer);
    946        
     946
    947947        /* Cancel PSM thread */
    948948        CHECK_FCT_DO( fd_thr_term(&peer->p_psm), /* continue */ );
    949        
     949
    950950        /* Cleanup the data */
    951951        fd_psm_cleanup(peer, 1);
    952        
     952
    953953        /* Destroy the event list */
    954954        CHECK_FCT_DO( fd_fifo_del(&peer->p_events), /* continue */ );
    955        
     955
    956956        /* Remaining cleanups are performed in fd_peer_free */
    957957        return;
Note: See TracChangeset for help on using the changeset viewer.