Navigation


Changeset 706:4ffbc9f1e922 in freeDiameter for libfdcore/sctp.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/sctp.c

    r691 r706  
    999999
    10001000/* Send a buffer over a specified stream */
    1001 int fd_sctp_sendstr(int sock, uint16_t strid, uint8_t * buf, size_t len, uint32_t * cc_status)
     1001int fd_sctp_sendstr(struct cnxctx * conn, uint16_t strid, uint8_t * buf, size_t len)
    10021002{
    10031003        struct msghdr mhdr;
     
    10091009        int timedout = 0;
    10101010       
    1011         TRACE_ENTRY("%d %hu %p %zd %p", sock, strid, buf, len, cc_status);
    1012         CHECK_PARAMS(cc_status);
     1011        TRACE_ENTRY("%p %hu %p %zd", conn, strid, buf, len);
     1012        CHECK_PARAMS(conn && buf && len);
    10131013       
    10141014        memset(&mhdr, 0, sizeof(mhdr));
     
    10371037        mhdr.msg_controllen = sizeof(anci);
    10381038       
    1039         TRACE_DEBUG(FULL, "Sending %db data on stream %hu of socket %d", len, strid, sock);
     1039        TRACE_DEBUG(FULL, "Sending %db data on stream %hu of socket %d", len, strid, conn->cc_socket);
    10401040again: 
    1041         ret = sendmsg(sock, &mhdr, 0);
     1041        ret = sendmsg(conn->cc_socket, &mhdr, 0);
    10421042        /* Handle special case of timeout */
    10431043        if ((ret < 0) && (errno == EAGAIN)) {
    1044                 if (!(*cc_status & CC_STATUS_CLOSING))
     1044                if (! fd_cnx_teststate(conn, CC_STATUS_CLOSING ))
    10451045                        goto again; /* don't care, just ignore */
    10461046                if (!timedout) {
     
    10571057
    10581058/* Receive the next data from the socket, or next notification */
    1059 int fd_sctp_recvmeta(int sock, uint16_t * strid, uint8_t ** buf, size_t * len, int *event, uint32_t * cc_status)
     1059int fd_sctp_recvmeta(struct cnxctx * conn, uint16_t * strid, uint8_t ** buf, size_t * len, int *event)
    10601060{
    10611061        ssize_t                  ret = 0;
     
    10681068        int                      timedout = 0;
    10691069       
    1070         TRACE_ENTRY("%d %p %p %p %p %p", sock, strid, buf, len, event, cc_status);
    1071         CHECK_PARAMS( (sock > 0) && buf && len && event && cc_status );
     1070        TRACE_ENTRY("%p %p %p %p %p", conn, strid, buf, len, event);
     1071        CHECK_PARAMS( conn && buf && len && event );
    10721072       
    10731073        /* Cleanup out parameters */
     
    10981098again:
    10991099        pthread_cleanup_push(free, data);
    1100         ret = recvmsg(sock, &mhdr, 0);
     1100        ret = recvmsg(conn->cc_socket, &mhdr, 0);
    11011101        pthread_cleanup_pop(0);
    11021102       
    11031103        /* First, handle timeouts (same as fd_cnx_s_recv) */
    11041104        if ((ret < 0) && (errno == EAGAIN)) {
    1105                 if (!(*cc_status & CC_STATUS_CLOSING))
     1105                if (! fd_cnx_teststate(conn, CC_STATUS_CLOSING ))
    11061106                        goto again; /* don't care, just ignore */
    11071107                if (!timedout) {
     
    11321132                union sctp_notification * notif = (union sctp_notification *) data;
    11331133               
    1134                 TRACE_DEBUG(FULL, "Received %db data of notification on socket %d", datasize, sock);
     1134                TRACE_DEBUG(FULL, "Received %db data of notification on socket %d", datasize, conn->cc_socket);
    11351135       
    11361136                switch (notif->sn_header.sn_type) {
     
    12261226                        *strid = sndrcv->sinfo_stream;
    12271227                }
    1228                 TRACE_DEBUG(FULL, "Received %db data on socket %d, stream %hu", datasize, sock, *strid);
     1228                TRACE_DEBUG(FULL, "Received %db data on socket %d, stream %hu", datasize, conn->cc_socket, *strid);
    12291229        } else {
    1230                 TRACE_DEBUG(FULL, "Received %db data on socket %d (stream ignored)", datasize, sock);
     1230                TRACE_DEBUG(FULL, "Received %db data on socket %d (stream ignored)", datasize, conn->cc_socket);
    12311231        }
    12321232       
Note: See TracChangeset for help on using the changeset viewer.