|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T d
Length: 6683 (0x1a1b)
Types: TextFile
Names: »dsa_collate.c«
└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape
└─⟦eba4602b1⟧ »./isode-5.0.tar.Z«
└─⟦d3ac74d73⟧
└─⟦this⟧ »isode-5.0/quipu/dsa_collate.c«
/* dsa_collate.c - collate dsa results */
#ifndef lint
static char *rcsid = "$Header: /f/osi/quipu/RCS/dsa_collate.c,v 6.0 89/03/18 23:41:29 mrose Rel $";
#endif
/*
* $Header: /f/osi/quipu/RCS/dsa_collate.c,v 6.0 89/03/18 23:41:29 mrose Rel $
*
*
* $Log: dsa_collate.c,v $
* Revision 6.0 89/03/18 23:41:29 mrose
* Release 5.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 "acsap.h"
#include "quipu/util.h"
#include "quipu/connection.h"
extern LLog * log_dsap;
int dn_print();
dsa_collate(task)
register struct activity * task;
{
struct activity * oper;
struct activity **oper_last;
DLOG (log_dsap,LLOG_TRACE,( "Collating!"));
/*
* For each outstanding operation:
* has it responded?
* yes: deal with response,
*/
oper_last = &(task->tk_operlist);
for(oper = task->tk_operlist; oper != NULLACTIVITY; )
{
if(oper->act_type == ACT_TYPE_RESP)
{
if(oper->act_resp.resp_type == RESP_TYPE_REJ)
{
DLOG(log_dsap, LLOG_EXCEPTIONS, ("Operation rejected"));
if((oper->act_conn == NULLCONN) && ((oper->on_ap_next != NULLACCESSPOINT) || (oper->on_cr_next != NULLCONTINUATIONREF)))
{
/* Association failed try another access_point */
LLOG(log_dsap, LLOG_EXCEPTIONS, ("Trying another access_point"));
if(oper_chain(oper) == NOTOK)
{
LLOG(log_dsap, LLOG_EXCEPTIONS, ("Oper_chain failed!"));
/* Should clean up operation here ! */
}
}
else
{
if(oper->refer_st != NULL_ST)
{
struct ds_search_result * tk_sr = &(task->act_resp.resp_res.dcr_dsres.res_sr);
DLOG(log_dsap, LLOG_NOTICE, ("Referral failed."));
#ifdef DEBUG
pslog(log_dsap, LLOG_NOTICE, "Add cref:",dn_print, (caddr_t) oper->refer_st->st_cr->cr_name);
#endif
oper->refer_st->st_cr->cr_next = tk_sr->srr_next->CSR_cr;
tk_sr->srr_next->CSR_cr = oper->refer_st->st_cr;
/* Make sure these references don't get freed! */
oper->refer_st->st_cr = NULLCONTINUATIONREF;
oper->refer_st = NULL_ST;
}
(*oper_last) = oper->on_next_task;
oper_conn_extract(oper);
if(oper->on_task == NULLACTIVITY)
act_free(oper);
}
}
else
{
if(oper->act_resp.ret_type == RET_TYPE_RES)
{
if(task->referred_st != NULL_ST)
{
struct ds_search_result * tk_sr = &(task->act_resp.resp_res.dcr_dsres.res_sr);
struct ds_search_result * op_sr = &(oper->act_resp.resp_res.dcr_dsres.res_sr);
/*
Correlate uncorrelated search results from oper,
then merge with correlated search results of task.
*/
LLOG(log_dsap, LLOG_DEBUG, ("Collating a search result"));
correlate_search_results(op_sr);
if(tk_sr->srr_next == NULLSRR)
{
LLOG(log_dsap, LLOG_DEBUG, ("Search result unallocated!"));
tk_sr->srr_next = (struct ds_search_result *) calloc(1, sizeof(struct ds_search_result));
tk_sr->srr_next->srr_correlated = TRUE;
tk_sr->srr_next->srr_un.srr_unit = (struct ds_search_unit *) calloc(1, sizeof(struct ds_search_unit));
}
merge_search_results(tk_sr->srr_next, op_sr);
(*oper_last) = oper->on_next_task;
oper_conn_extract(oper);
if(oper->on_task == NULLACTIVITY)
act_free(oper);
}
else
{
task->act_class = ACTIVITY_NET_SEND;
task->act_type = ACT_TYPE_RESP;
task->act_resp.resp_type = RESP_TYPE_RET;
task->act_resp.ret_type = oper->act_resp.ret_type;
task->act_result = &(oper->act_resp.resp_res);
dsp_cache (&(task->act_req.dca_dsarg),&(task->act_result->dcr_dsres));
oper_last = &(oper->on_next_task);
}
}
else /* RET_TYPE = RET_TYPE_ERR */
{
if(oper->act_resp.resp_err.dse_type == DSE_DSAREFERRAL)
{
LLOG(log_dsap, LLOG_FATAL, ("Rechain op"));
/* Set this referral as the one to return on failure */
task->act_error = &(oper->act_resp.resp_err);
dsa_rechain(oper);
oper_last = &(oper->on_next_task);
}
else
/*
if((task->act_type != ACT_TYPE_RESP)
|| (task->act_resp.resp_type != RESP_TYPE_RET)
|| (task->act_resp.ret_type != RET_TYPE_RES))
*/
{
if(task->referred_st == NULL_ST)
{
task->act_class = ACTIVITY_NET_SEND;
task->act_type = ACT_TYPE_RESP;
task->act_resp.resp_type = RESP_TYPE_RET;
task->act_resp.ret_type = oper->act_resp.ret_type;
task->act_error = &(oper->act_resp.resp_err);
oper_last = &(oper->on_next_task);
}
else
{
(*oper_last) = oper->on_next_task;
oper_conn_extract(oper);
if(oper->on_task == NULLACTIVITY)
act_free(oper);
}
}
}
}
}
else
{
oper_last = &(oper->on_next_task);
}
oper = *oper_last;
}
if(task->referred_st != NULL_ST)
{
if(task->tk_operlist == NULLACTIVITY)
{ /* Finished all chained sub-searches */
struct ds_search_result * tk_sr = &(task->act_resp.resp_res.dcr_dsres.res_sr);
task->act_class = ACTIVITY_NET_SEND;
task->act_type = ACT_TYPE_RESP;
task->act_resp.resp_type = RESP_TYPE_RET;
task->act_resp.ret_type = RET_TYPE_RES;
merge_search_results(tk_sr, tk_sr->srr_next);
#ifdef DEBUG
if(tk_sr->CSR_cr != NULLCONTINUATIONREF)
{
ContinuationRef cr_tmp;
for(cr_tmp = tk_sr->CSR_cr; cr_tmp != NULLCONTINUATIONREF; cr_tmp = cr_tmp->cr_next)
{
pslog(log_dsap, LLOG_DEBUG, "ref entry:", dn_print, (caddr_t) cr_tmp->cr_name);
}
}
else
{
LLOG(log_dsap, LLOG_DEBUG, ("No references"));
}
#endif
DLOG(log_dsap, LLOG_DEBUG, ("Last merge of results completed"));
/*
dsp_cache (&(task->act_req.dca_dsarg),&(task->act_result->dcr_dsres));
*/
}
}
if(task->act_type == ACT_TYPE_CHN)
{
if(task->tk_operlist == NULLACTIVITY)
{ /* Fall back on returning the most recent referral error */
task->act_resp.resp_type = RESP_TYPE_RET;
task->act_resp.ret_type = RET_TYPE_ERR;
task->act_class = ACTIVITY_NET_SEND;
/*
task->act_error = &(task->act_resp.resp_err);
*/
if(task->act_conn->cn_dsa)
task->act_resp.resp_err.dse_type = DSE_DSAREFERRAL;
else
task->act_resp.resp_err.dse_type = DSE_REFERRAL;
}
else
{
task->act_class = ACTIVITY_NET_WAIT;
}
}
if((task->act_class == ACTIVITY_NET_SEND)
&& (task->act_conn->cn_state == CN_STATE_INIT))
{
DLOG(log_dsap, LLOG_DEBUG, ("Set up dsa_bind_collate call"));
task->act_class = ACTIVITY_NET_WAIT;
task->act_conn->cn_init_act.ia_class = ACTIVITY_COLLATE;
}
}