DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T c

⟦5b5dbf0b2⟧ TextFile

    Length: 4809 (0x12c9)
    Types: TextFile
    Names: »conn.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦35176feda⟧ »EurOpenD22/isode/isode-6.tar.Z« 
        └─⟦de7628f85⟧ 
            └─⟦this⟧ »isode-6.0/quipu/conn.c« 

TextFile

/* conn.c - */

#ifndef lint
static char *rcsid = "$Header: /f/osi/quipu/RCS/conn.c,v 7.0 89/11/23 22:16:42 mrose Rel $";
#endif

/*
 * $Header: /f/osi/quipu/RCS/conn.c,v 7.0 89/11/23 22:16:42 mrose Rel $
 *
 *
 * $Log:	conn.c,v $
 * Revision 7.0  89/11/23  22:16:42  mrose
 * Release 6.0
 * 
 */

/*
 *                                NOTICE
 *
 *    Acquisition, use, and distribution of this module and related
 *    materials are subject to the restrictions of a license agreement.
 *    Consult the Preface in the User's Manual for the full terms of
 *    this agreement.
 *
 */

#include "rosap.h"
#include "quipu/util.h"
#include "quipu/connection.h"

extern LLog * log_dsap;

Conn    conn_alloc()
{
    Conn        conn_ret;

    conn_ret = (Conn) calloc(1,sizeof(struct connection));
    conn_ret->cn_op_id = 1;

    return(conn_ret);
}

conn_free(conn)
Conn    conn;
{
	DLOG(log_dsap, LLOG_TRACE, ("conn_free()"));

    if(conn->cn_what != NULLDN)
	dn_free(conn->cn_what);
    if(conn->cn_who != NULLDN)
	dn_free(conn->cn_who);

    if (conn->cn_init_act.ia_vec[0])
	free (conn->cn_init_act.ia_vec[0]);
    if (conn->cn_init_act.ia_vec[1])
	free (conn->cn_init_act.ia_vec[1]);
    if (conn->cn_init_act.ia_vec[2])
	free (conn->cn_init_act.ia_vec[2]);
    if (conn->cn_init_act.ia_vec[3])
	free (conn->cn_init_act.ia_vec[3]);

    bind_arg_free (&conn->cn_init_act.ia_req);	
    bind_arg_free (&conn->cn_init_act.ia_res);	

    free((char *)conn);
}

conn_extract(conn)
Conn      conn;
{
    /*
    * Extract all the operations made on this connection, and all
    * the tasks (and their derivative operations) made on the connection;
    * then remove the connection from the list of active connections.
    */

    struct oper_act     * on;
    struct oper_act     * on_next;
    struct task_act     * tk;
    struct task_act     * tk_next;
    struct connection	* cn;
    struct connection	**cn_p;
    struct DSError	* err;

    DLOG (log_dsap,LLOG_TRACE, ("conn_extract"));

    if(conn == NULLCONN)
    {
	LLOG(log_dsap, LLOG_EXCEPTIONS, ("Extracting NULLCONN!!!"));
	return;
    }

    cn_p = &(connlist);
    for(cn=connlist; cn!=NULLCONN; cn=cn->cn_next)
    {
	DLOG(log_dsap, LLOG_DEBUG, ("checking connlist"));
	if(cn == conn)
	    break;

	cn_p = &(cn->cn_next);
    }
    if(cn==NULLCONN)
    {
	LLOG(log_dsap, LLOG_EXCEPTIONS, ("conn_extract - connection not in connlist"));
    }
    else
    {
	/* Cut connection loose from global list */
	DLOG(log_dsap, LLOG_DEBUG, ("Extracting conn from connlist"));
	(*cn_p) = cn->cn_next;
	conns_used--;
    }

    for(on=conn->cn_operlist; on!=NULLOPER; on=on_next)
    {
	on_next = on->on_next_conn;
	oper_fail_wakeup (on);
    }

    for(tk=conn->cn_tasklist; tk!=NULLTASK; tk=tk_next)
    {
	    tk_next = tk->tk_next;
	    err = &(tk->tk_resp.resp_err);
	    if((err->dse_type != DSE_REFERRAL) && (err->dse_type != DSE_DSAREFERRAL))
	    {
		err->dse_type = DSE_SERVICEERROR;
		err->ERR_SERVICE.DSE_sv_problem = DSE_SV_UNAVAILABLE;
	    }
	    task_error(tk);
	    task_extract(tk);
    }

    conn_free(conn);
}

conn_log(conn)
struct connection       * conn;
{
    struct oper_act     * oper;
    struct task_act     * task;

    if(conn == NULLCONN)
    {
	LLOG (log_dsap,LLOG_NOTICE, ("Connection: NULLCONN"));
	return;
    }

    DLOG (log_dsap,LLOG_DEBUG, ("Connection [%x], ad = %d, ctx = %d", conn, conn->cn_ad, conn->cn_ctx));

#ifdef DEBUG
    switch(conn->cn_state)
    {
    case CN_INDICATED:
	DLOG (log_dsap,LLOG_DEBUG, ("State: INDICATED"));
    break;
    case CN_WAITING:
	DLOG (log_dsap,LLOG_DEBUG, ("State: WAITING"));
    break;
    case CN_CONNECTING1:
	DLOG (log_dsap,LLOG_DEBUG, ("State: CONNECTING 1"));
    break;
    case CN_CONNECTING2:
	DLOG (log_dsap,LLOG_DEBUG, ("State: CONNECTING 2"));
    break;
    case CN_OPEN:
	DLOG (log_dsap,LLOG_DEBUG, ("State: OPEN"));
    break;
    case CN_FAILED:
	DLOG (log_dsap,LLOG_DEBUG, ("State: FAIL"));
    break;
    case CN_CLOSING:
	DLOG (log_dsap,LLOG_DEBUG, ("State: CLOSING"));
    break;
    case CN_OPENING:
	DLOG (log_dsap,LLOG_DEBUG, ("State: OPENING"));
    break;
    default:
	DLOG (log_dsap,LLOG_DEBUG, ("State: Erroneous - %d",conn->cn_state));
    break;
    }
#endif

    DLOG (log_dsap,LLOG_DEBUG, ("Tasks:"));
    for(task=conn->cn_tasklist; task!=NULLTASK; task=task->tk_next)
	task_log(task);
    DLOG (log_dsap,LLOG_DEBUG, ("Opers:"));
    for(oper=conn->cn_operlist; oper!=NULLOPER; oper=oper->on_next_conn)
	oper_log(oper);
    DLOG (log_dsap,LLOG_DEBUG, ("!"));
}

conn_list_log(cn)
struct connection	* cn;
{
    struct connection	* cn_tmp;

    DLOG(log_dsap, LLOG_DEBUG, ("Connection List:"));
    for(cn_tmp=cn; cn_tmp!=NULLCONN; cn_tmp=cn_tmp->cn_next)
    {
	conn_log(cn_tmp);
    }
    DLOG(log_dsap, LLOG_DEBUG, ("End of Connection List."));
}