Annotation of 43BSDReno/contrib/isode-beta/quipu/conn_release.c, revision 1.1

1.1     ! root        1: /* conn_release.c - normal association release */
        !             2: 
        !             3: #ifndef lint
        !             4: static char *rcsid = "$Header: /f/osi/quipu/RCS/conn_release.c,v 7.0 89/11/23 22:16:48 mrose Rel $";
        !             5: #endif
        !             6: 
        !             7: /*
        !             8:  * $Header: /f/osi/quipu/RCS/conn_release.c,v 7.0 89/11/23 22:16:48 mrose Rel $
        !             9:  *
        !            10:  *
        !            11:  * $Log:       conn_release.c,v $
        !            12:  * Revision 7.0  89/11/23  22:16:48  mrose
        !            13:  * Release 6.0
        !            14:  * 
        !            15:  */
        !            16: 
        !            17: /*
        !            18:  *                                NOTICE
        !            19:  *
        !            20:  *    Acquisition, use, and distribution of this module and related
        !            21:  *    materials are subject to the restrictions of a license agreement.
        !            22:  *    Consult the Preface in the User's Manual for the full terms of
        !            23:  *    this agreement.
        !            24:  *
        !            25:  */
        !            26: 
        !            27: 
        !            28: /* LINTLIBRARY */
        !            29: 
        !            30: #include "quipu/dsap.h"
        !            31: #include "quipu/util.h"
        !            32: #include "quipu/connection.h"
        !            33: 
        !            34: extern  LLog    * log_dsap;
        !            35: extern time_t    timenow;
        !            36: 
        !            37: struct connection      * conn_alloc();
        !            38: void                     conn_free();
        !            39: void                     ds_log ();
        !            40: 
        !            41: conn_release(conn)
        !            42: struct connection       * conn;
        !            43: {
        !            44:     int                                  result;
        !            45:     struct DSAPrelease           dr_s;
        !            46:     struct DSAPrelease         * dr = &(dr_s);
        !            47:     struct DSAPindication        di_s;
        !            48:     struct DSAPindication      * di = &(di_s);
        !            49:     struct DSAPabort           * da = &(di->di_abort);
        !            50: 
        !            51:     DLOG(log_dsap, LLOG_TRACE, ("conn_release"));
        !            52: 
        !            53: 
        !            54:     DLOG(log_dsap, LLOG_NOTICE, ("D-UNBIND: <%d, normal, OK>", conn->cn_ad));
        !            55: 
        !            56:     watch_dog ("DUnBindRequest");
        !            57:     result = DUnBindRequest (conn->cn_ad, OK, dr, di);
        !            58:     watch_dog_reset();
        !            59: 
        !            60:     switch (result) {
        !            61:     case NOTOK:
        !            62:        do_ds_unbind(conn);
        !            63:        DLOG(log_dsap, LLOG_TRACE, ("conn_release: DUnBindRequest - NOTOK"));
        !            64:        ds_log(da, "A-RELEASE.REQUEST");
        !            65:        break;
        !            66:    case OK:
        !            67:        DLOG(log_dsap, LLOG_TRACE, ("conn_release: dr_affirmative = %d", dr->dr_affirmative));
        !            68:        if (!dr->dr_affirmative)
        !            69:        {
        !            70:            if ((conn->cn_last_release == conn->cn_last_used) 
        !            71:                && (conn->cn_initiator)) {
        !            72:                    LLOG (log_dsap,LLOG_EXCEPTIONS,("conn_release rejected again without activity - Aborting %d",conn->cn_ad));
        !            73:                    do_ds_unbind(conn);
        !            74:                    DUAbortRequest (conn->cn_ad, di);
        !            75:            } else {
        !            76:                    LLOG (log_dsap,LLOG_EXCEPTIONS,("conn_release rejected - continuing with association %d",conn->cn_ad));
        !            77:                    conn->cn_last_release = conn->cn_last_used = timenow;
        !            78:                    return NOTOK;
        !            79:            }
        !            80:        }
        !            81:        else
        !            82:        {
        !            83:            do_ds_unbind(conn);
        !            84:            DLOG(log_dsap, LLOG_TRACE, ("conn_release: Conn finished!"));
        !            85:        }
        !            86:        break;
        !            87:     case DONE:
        !            88:        DLOG (log_dsap,LLOG_NOTICE, ("Waiting for release"));
        !            89:        conn->cn_state = CN_CLOSING;
        !            90:        conn->cn_last_release = conn->cn_last_used = timenow;
        !            91:        return NOTOK;
        !            92:     default:
        !            93:        LLOG (log_dsap, LLOG_EXCEPTIONS, ("Unexpected return from DUnBindRequest"));
        !            94:        return NOTOK;
        !            95:     }
        !            96: 
        !            97:     DLOG(log_dsap, LLOG_DEBUG, ("conn_release calling conn_extract"));
        !            98:     conn_extract(conn);
        !            99:     return OK;
        !           100: }
        !           101: 
        !           102: conn_release_retry(conn)
        !           103: struct connection       * conn;
        !           104: {
        !           105:     int                                  result;
        !           106:     struct DSAPrelease           dr_s;
        !           107:     struct DSAPrelease         * dr = &(dr_s);
        !           108:     struct DSAPindication        di_s;
        !           109:     struct DSAPindication      * di = &(di_s);
        !           110:     struct DSAPabort           * da = &(di->di_abort);
        !           111: 
        !           112:     DLOG(log_dsap, LLOG_NOTICE, ("conn_release retry (%d)",conn->cn_ad));
        !           113: 
        !           114:     watch_dog ("DUnBindRetry");
        !           115:     result = DUnBindRetry (conn->cn_ad, OK, dr, di);
        !           116:     watch_dog_reset ();
        !           117: 
        !           118:     switch (result) {
        !           119:     case NOTOK:
        !           120:        do_ds_unbind(conn);
        !           121:        DLOG(log_dsap, LLOG_TRACE, ("conn_release: DUnBindRetry - NOTOK"));
        !           122:        ds_log(da, "D-UNBIND.REQUEST");
        !           123:        break;
        !           124:    case OK:
        !           125:        DLOG(log_dsap, LLOG_TRACE, ("conn_release: dr_affirmative = %d", dr->dr_affirmative));
        !           126:        if (!dr->dr_affirmative)
        !           127:        {
        !           128:            if ((conn->cn_last_release == conn->cn_last_used) 
        !           129:                && (conn->cn_initiator)) {
        !           130:                    LLOG (log_dsap,LLOG_EXCEPTIONS,("conn_release rejected again without activity - Aborting %d",conn->cn_ad));
        !           131:                    do_ds_unbind(conn);
        !           132:                    DUAbortRequest (conn->cn_ad, di);
        !           133:            } else {
        !           134:                    LLOG (log_dsap,LLOG_EXCEPTIONS,("conn_release rejected - continuing with association %d",conn->cn_ad));
        !           135:                    conn->cn_last_release = conn->cn_last_used = timenow;
        !           136:                    return NOTOK;
        !           137:            }
        !           138:        }
        !           139:        else
        !           140:        {
        !           141:            do_ds_unbind(conn);
        !           142:            DLOG(log_dsap, LLOG_TRACE, ("conn_release: Conn finished!"));
        !           143:        }
        !           144:        break;
        !           145:     case DONE:
        !           146:        DLOG (log_dsap,LLOG_TRACE, ("Still Waiting for release"));
        !           147:        conn->cn_last_release = conn->cn_last_used = timenow;
        !           148:        return NOTOK;
        !           149:     default:
        !           150:        LLOG (log_dsap, LLOG_EXCEPTIONS, ("Unexpected return from DUnBindRetry"));
        !           151:        return NOTOK;
        !           152:     }
        !           153: 
        !           154:     DLOG(log_dsap, LLOG_DEBUG, ("conn_release calling conn_extract"));
        !           155:     conn_extract(conn);
        !           156:     return OK;
        !           157: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.