mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 06:03:02 +01:00
Cleanup and bugfixing
This commit is contained in:
parent
ca1aed40ba
commit
2a3a320010
@ -2601,7 +2601,7 @@ static BDB alloc_bdb(TDBB tdbb, BCB bcb, UCHAR ** memory)
|
||||
throw;
|
||||
}
|
||||
lock->lck_ast = reinterpret_cast<lck_ast_t>(blocking_ast_bdb);
|
||||
lock->lck_object = (class blk*) bdb_;
|
||||
lock->lck_object = reinterpret_cast<blk*>(bdb_);
|
||||
#endif
|
||||
|
||||
bdb_->bdb_buffer = (PAG) * memory;
|
||||
@ -4518,7 +4518,7 @@ static SSHORT lock_buffer(
|
||||
|
||||
if (page_type == pag_header || page_type == pag_transactions) {
|
||||
assert(lock->lck_ast == reinterpret_cast<lck_ast_t>(blocking_ast_bdb));
|
||||
assert(lock->lck_object == (BLK) bdb);
|
||||
assert(lock->lck_object == reinterpret_cast<blk*>(bdb));
|
||||
lock->lck_ast = 0;
|
||||
lock->lck_object = NULL;
|
||||
}
|
||||
@ -4535,7 +4535,7 @@ static SSHORT lock_buffer(
|
||||
assert(page_type == pag_header
|
||||
|| page_type == pag_transactions);
|
||||
lock->lck_ast = reinterpret_cast<lck_ast_t>(blocking_ast_bdb);
|
||||
lock->lck_object = (class blk*) bdb;
|
||||
lock->lck_object = reinterpret_cast<blk*>(bdb);
|
||||
bdb->bdb_flags |= BDB_no_blocking_ast;
|
||||
}
|
||||
return 1;
|
||||
@ -4544,7 +4544,7 @@ static SSHORT lock_buffer(
|
||||
if (!lock->lck_ast) {
|
||||
assert(page_type == pag_header || page_type == pag_transactions);
|
||||
lock->lck_ast = reinterpret_cast<lck_ast_t>(blocking_ast_bdb);
|
||||
lock->lck_object = (class blk*) bdb;
|
||||
lock->lck_object = reinterpret_cast<blk*>(bdb);
|
||||
}
|
||||
|
||||
/* Case: a timeout was specified, or the caller didn't want to wait,
|
||||
|
@ -498,7 +498,7 @@ IDB IDX_create_index_block(TDBB tdbb, REL relation, UCHAR id)
|
||||
lock->lck_type = LCK_expression;
|
||||
lock->lck_owner_handle = LCK_get_owner_handle(tdbb, lock->lck_type);
|
||||
lock->lck_ast = reinterpret_cast<lck_ast_t>(index_block_flush);
|
||||
lock->lck_object = (BLK) index_block;
|
||||
lock->lck_object = reinterpret_cast<blk*>(index_block);
|
||||
|
||||
return index_block;
|
||||
}
|
||||
|
@ -887,13 +887,13 @@ void LCK_re_post(LCK lock)
|
||||
|
||||
assert(LCK_CHECK_LOCK(lock));
|
||||
if (lock->lck_compatible) {
|
||||
if (lock->lck_ast)
|
||||
reinterpret_cast < int (*) (...) >
|
||||
(*lock->lck_ast) (lock->lck_object);
|
||||
if (lock->lck_ast) {
|
||||
reinterpret_cast<int (*)(blk*)>(*lock->lck_ast)(lock->lck_object);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
LOCK_re_post(reinterpret_cast < int (*)(void *)>(lock->lck_ast),
|
||||
LOCK_re_post(reinterpret_cast<int (*)(void*)>(lock->lck_ast),
|
||||
lock->lck_object, lock->lck_owner_handle);
|
||||
assert(LCK_CHECK_LOCK(lock));
|
||||
}
|
||||
@ -1032,8 +1032,7 @@ static void enqueue(TDBB tdbb, LCK lock, USHORT level, SSHORT wait)
|
||||
(UCHAR *) & lock->lck_key,
|
||||
lock->lck_length,
|
||||
level,
|
||||
reinterpret_cast <
|
||||
int (*)(void *) >(lock->lck_ast),
|
||||
reinterpret_cast<int (*)(void*)>(lock->lck_ast),
|
||||
lock->lck_object, lock->lck_data, wait,
|
||||
tdbb->tdbb_status_vector, lock->lck_owner_handle);
|
||||
if (!lock->lck_id)
|
||||
@ -1066,8 +1065,7 @@ static void external_ast(LCK lock)
|
||||
for (match = hash_get_lock(lock, 0, 0); match; match = next) {
|
||||
next = match->lck_identical;
|
||||
if (match->lck_ast)
|
||||
reinterpret_cast < int (*) (...) >
|
||||
(*match->lck_ast) (match->lck_object);
|
||||
reinterpret_cast<int (*)(...)>(*match->lck_ast)(match->lck_object);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1378,7 +1376,9 @@ static void internal_ast(LCK lock)
|
||||
if ((match != lock) &&
|
||||
!compatible(match, lock, lock->lck_logical) &&
|
||||
match->lck_ast)
|
||||
reinterpret_cast < int (*) (...) > (*match->lck_ast) (match->lck_object);
|
||||
{
|
||||
reinterpret_cast<int (*)(...)>(*match->lck_ast)(match->lck_object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
*
|
||||
*/
|
||||
/*
|
||||
$Id: met.epp,v 1.6 2002-02-24 16:39:31 seanleyne Exp $
|
||||
$Id: met.epp,v 1.7 2002-03-31 00:38:21 tamlin Exp $
|
||||
*/
|
||||
// This MUST be at the top of the file
|
||||
#ifdef DARWIN
|
||||
@ -1863,7 +1863,7 @@ PRC MET_lookup_procedure_id(TDBB tdbb,
|
||||
}
|
||||
|
||||
|
||||
REL MET_lookup_relation(TDBB tdbb, CONST SCHAR* name)
|
||||
REL MET_lookup_relation(TDBB tdbb, const char* name)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
|
@ -62,7 +62,7 @@ SLONG MET_lookup_index_name(TDBB, TEXT *, SLONG *, SSHORT *);
|
||||
int MET_lookup_partner(TDBB, struct rel *, struct idx *, UCHAR *);
|
||||
struct prc *MET_lookup_procedure(TDBB, SCHAR *);
|
||||
struct prc *MET_lookup_procedure_id(TDBB, SSHORT, BOOLEAN, USHORT);
|
||||
struct rel *MET_lookup_relation(TDBB, CONST SCHAR*);
|
||||
struct rel *MET_lookup_relation(TDBB, const char*);
|
||||
struct rel *MET_lookup_relation_id(TDBB, SLONG, BOOLEAN);
|
||||
struct nod *MET_parse_blob(TDBB, struct rel *, SLONG[2], class Csb **,
|
||||
struct req **, BOOLEAN, BOOLEAN);
|
||||
|
@ -670,7 +670,7 @@ static FIL dfs_setup_file(dbb, file_name, file_length, desc)
|
||||
dbb->dbb_lock = lock = new(*dbb->dbb_permanent, l) lck();
|
||||
lock->lck_type = LCK_database;
|
||||
lock->lck_owner_handle = LCK_get_owner_handle(NULL_TDBB, lock->lck_type);
|
||||
lock->lck_object = (BLK) dbb;
|
||||
lock->lck_object = reinterpret_cast<blk*>(dbb);
|
||||
lock->lck_length = l;
|
||||
lock->lck_dbb = dbb;
|
||||
lock->lck_ast = CCH_down_grade_dbb;
|
||||
|
@ -619,7 +619,7 @@ static FIL setup_file(
|
||||
dbb->dbb_lock = lock = new(*dbb->dbb_permanent, file_length) lck();
|
||||
lock->lck_type = LCK_database;
|
||||
lock->lck_owner_handle = LCK_get_owner_handle(NULL_TDBB, lock->lck_type);
|
||||
lock->lck_object = (BLK) dbb;
|
||||
lock->lck_object = reinterpret_cast<blk*>(dbb);
|
||||
lock->lck_length = file_length;
|
||||
lock->lck_ast = CCH_down_grade_dbb;
|
||||
lock->lck_dbb = dbb;
|
||||
|
@ -317,7 +317,7 @@ LCK RLCK_record_locking(REL relation)
|
||||
someone gets an incompatible lock */
|
||||
|
||||
lock->lck_ast = start_record_locking;
|
||||
lock->lck_object = (BLK) relation;
|
||||
lock->lck_object = reinterpret_cast<blk*>(relation);
|
||||
|
||||
/* now attempt to get a PR on the lock to detect when
|
||||
anyone locks a record explicitly */
|
||||
@ -569,7 +569,7 @@ void RLCK_signal_refresh(TRA transaction)
|
||||
if (lock) {
|
||||
relation = (REL) lock->lck_object;
|
||||
local_lock->lck_key.lck_long = relation->rel_id;
|
||||
local_lock->lck_object = (BLK) relation;
|
||||
local_lock->lck_object = reinterpret_cast<blk*>(relation);
|
||||
LCK_lock_non_blocking(tdbb, local_lock, LCK_SW, 0);
|
||||
LCK_release(tdbb, local_lock);
|
||||
}
|
||||
@ -800,7 +800,7 @@ static LCK allocate_record_lock(TRA transaction, RPB * rpb)
|
||||
lock = new(*dbb->dbb_permanent, sizeof(SLONG)) lck();
|
||||
lock->lck_dbb = dbb;
|
||||
lock->lck_attachment = attachment;
|
||||
lock->lck_object = (BLK) dbb;
|
||||
lock->lck_object = reinterpret_cast<blk*>(dbb);
|
||||
lock->lck_type = LCK_record;
|
||||
lock->lck_owner_handle = LCK_get_owner_handle(tdbb, lock->lck_type);
|
||||
/* use the relation lock as the lock parent */
|
||||
@ -863,7 +863,7 @@ static LCK allocate_relation_lock(MemoryPool* pool, REL relation)
|
||||
lock->lck_compatible = (BLK) tdbb->tdbb_attachment;
|
||||
/* the lck_object is used here to find the relation
|
||||
block from the lock block */
|
||||
lock->lck_object = (BLK) relation;
|
||||
lock->lck_object = reinterpret_cast<blk*>(relation);
|
||||
return lock;
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ void RNG_add_page(ULONG page_number)
|
||||
page_lock = CCH_page_lock(tdbb, ERR_jmp);
|
||||
page_lock->lck_key.lck_long = page_number;
|
||||
page_lock->lck_ast = post_event_ast;
|
||||
page_lock->lck_object = (BLK) refresh_range;
|
||||
page_lock->lck_object = reinterpret_cast<blk*>(refresh_range);
|
||||
|
||||
/* if we can get the lock, place it in a vector of page locks for this
|
||||
refresh range; otherwise just post the range event assuming that the
|
||||
@ -332,7 +332,7 @@ void RNG_add_uncommitted_record(RPB * rpb)
|
||||
TRA_transaction_lock(tdbb, (BLK) rpb->rpb_transaction);
|
||||
transaction_lock->lck_key.lck_long = rpb->rpb_transaction;
|
||||
transaction_lock->lck_ast = post_event_ast;
|
||||
transaction_lock->lck_object = (BLK) refresh_range;
|
||||
transaction_lock->lck_object = reinterpret_cast<blk*>(refresh_range);
|
||||
|
||||
/* try to get a shared read on the transaction lock, which will force
|
||||
the holder of an exclusive lock to downgrade; this is also his notification
|
||||
|
@ -602,8 +602,8 @@ void SDW_init(USHORT activate, USHORT delete_, SBM sbm_rec)
|
||||
lock->lck_parent = dbb->dbb_lock;
|
||||
lock->lck_length = key_length;
|
||||
lock->lck_dbb = dbb;
|
||||
lock->lck_object = (BLK) dbb;
|
||||
lock->lck_ast = reinterpret_cast < int (*) () > (SDW_start_shadowing);
|
||||
lock->lck_object = reinterpret_cast<blk*>(dbb);
|
||||
lock->lck_ast = reinterpret_cast<int (*)()>(SDW_start_shadowing);
|
||||
|
||||
if (activate)
|
||||
activate_shadow();
|
||||
|
@ -184,7 +184,7 @@ BOOLEAN TRA_active_transactions(TDBB tdbb, DBB dbb)
|
||||
MOVE_CLEAR(&temp_lock, sizeof(struct lck));
|
||||
temp_lock.blk_type = type_lck;
|
||||
temp_lock.lck_dbb = dbb;
|
||||
temp_lock.lck_object = (BLK) trans;
|
||||
temp_lock.lck_object = reinterpret_cast<blk*>(trans);
|
||||
temp_lock.lck_type = LCK_tra;
|
||||
temp_lock.lck_owner_handle =
|
||||
LCK_get_owner_handle(tdbb, temp_lock.lck_type);
|
||||
@ -1569,7 +1569,7 @@ TRA TRA_start(TDBB tdbb, int tpb_length, SCHAR * tpb)
|
||||
in the new transaction's lock. */
|
||||
|
||||
lock->lck_data = active;
|
||||
lock->lck_object = (BLK) trans;
|
||||
lock->lck_object = reinterpret_cast<blk*>(trans);
|
||||
|
||||
if (!LCK_lock_non_blocking(tdbb, lock, LCK_write, TRUE)) {
|
||||
#ifndef SUPERSERVER_V2
|
||||
@ -1617,7 +1617,7 @@ TRA TRA_start(TDBB tdbb, int tpb_length, SCHAR * tpb)
|
||||
|
||||
//MOVE_CLEAR(&temp_lock, sizeof(struct lck)); // Taken care of in lck constructor.
|
||||
temp_lock.lck_dbb = dbb;
|
||||
temp_lock.lck_object = (BLK) trans;
|
||||
temp_lock.lck_object = reinterpret_cast<blk*>(trans);
|
||||
temp_lock.lck_type = LCK_tra;
|
||||
temp_lock.lck_owner_handle =
|
||||
LCK_get_owner_handle(tdbb, temp_lock.lck_type);
|
||||
@ -1858,7 +1858,7 @@ int TRA_sweep(TDBB tdbb, TRA trans)
|
||||
MOVE_CLEAR(&temp_lock, sizeof(struct lck));
|
||||
//temp_lock.blk_type = type_lck;
|
||||
temp_lock.lck_dbb = dbb;
|
||||
temp_lock.lck_object = (BLK) trans;
|
||||
temp_lock.lck_object = reinterpret_cast<blk*>(trans);
|
||||
temp_lock.lck_type = LCK_sweep;
|
||||
temp_lock.lck_owner_handle =
|
||||
LCK_get_owner_handle(tdbb, temp_lock.lck_type);
|
||||
@ -2343,7 +2343,7 @@ static void compute_oldest_retaining(
|
||||
lock->lck_owner_handle = LCK_get_owner_handle(tdbb, lock->lck_type);
|
||||
lock->lck_parent = dbb->dbb_lock;
|
||||
lock->lck_length = sizeof(SLONG);
|
||||
lock->lck_object = (BLK) dbb;
|
||||
lock->lck_object = reinterpret_cast<blk*>(dbb);
|
||||
#ifdef VMS
|
||||
if (LCK_lock(tdbb, lock, LCK_EX, FALSE)) {
|
||||
number = 0;
|
||||
@ -2398,7 +2398,7 @@ static void compute_oldest_retaining(
|
||||
LCK_get_owner_handle(tdbb, temp_lock.lck_type);
|
||||
temp_lock.lck_parent = dbb->dbb_lock;
|
||||
temp_lock.lck_length = sizeof(SLONG);
|
||||
temp_lock.lck_object = (BLK) transaction;
|
||||
temp_lock.lck_object = reinterpret_cast<blk*>(transaction);
|
||||
|
||||
while (number < youngest_retaining) {
|
||||
temp_lock.lck_key.lck_long = ++number;
|
||||
@ -2478,39 +2478,36 @@ static void expand_view_lock(TRA transaction, REL relation, SCHAR lock_type)
|
||||
* view being locked.
|
||||
*
|
||||
**************************************/
|
||||
LCK lock;
|
||||
REL rel;
|
||||
VCX ctx;
|
||||
TDBB tdbb;
|
||||
|
||||
tdbb = GET_THREAD_DATA;
|
||||
TDBB tdbb = GET_THREAD_DATA;
|
||||
|
||||
/* set up the lock on the relation/view */
|
||||
/* set up the lock on the relation/view */
|
||||
|
||||
lock = RLCK_transaction_relation_lock(transaction, relation);
|
||||
LCK lock = RLCK_transaction_relation_lock(transaction, relation);
|
||||
|
||||
lock->lck_logical = lock_type;
|
||||
#ifdef GATEWAY
|
||||
lock->lck_reserved = lock->lck_logical;
|
||||
#endif
|
||||
|
||||
if (!(ctx = relation->rel_view_contexts))
|
||||
VCX ctx = relation->rel_view_contexts;
|
||||
if (!ctx) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (; ctx; ctx = ctx->vcx_next) {
|
||||
if (!
|
||||
(rel =
|
||||
MET_lookup_relation(tdbb, reinterpret_cast < char *>(ctx->vcx_relation_name->str_data)))) ERR_post(gds_bad_tpb_content, /* should be a BUGCHECK */
|
||||
gds_arg_gds,
|
||||
gds_relnotdef,
|
||||
gds_arg_string,
|
||||
ERR_cstring
|
||||
(reinterpret_cast
|
||||
<
|
||||
char
|
||||
*>
|
||||
(ctx->vcx_relation_name->str_data)),
|
||||
0);
|
||||
for (; ctx; ctx = ctx->vcx_next)
|
||||
{
|
||||
REL rel = MET_lookup_relation(tdbb,
|
||||
reinterpret_cast<const char*>(ctx->vcx_relation_name->str_data));
|
||||
if (!rel)
|
||||
{
|
||||
ERR_post(gds_bad_tpb_content, /* should be a BUGCHECK */
|
||||
gds_arg_gds,
|
||||
gds_relnotdef,
|
||||
gds_arg_string,
|
||||
ERR_cstring(reinterpret_cast<char*>(ctx->vcx_relation_name->str_data)),
|
||||
0);
|
||||
}
|
||||
|
||||
/* force a scan to read view information */
|
||||
MET_scan_relation(tdbb, rel);
|
||||
|
@ -1011,7 +1011,7 @@ static FIL setup_file(
|
||||
dbb->dbb_lock = lock = new(*dbb->dbb_permanent, l) lck();
|
||||
lock->lck_type = LCK_database;
|
||||
lock->lck_owner_handle = LCK_get_owner_handle(NULL_TDBB, lock->lck_type);
|
||||
lock->lck_object = (BLK) dbb;
|
||||
lock->lck_object = reinterpret_cast<blk*>(dbb);
|
||||
lock->lck_length = l;
|
||||
lock->lck_dbb = dbb;
|
||||
lock->lck_ast = reinterpret_cast<lck_ast_t>(CCH_down_grade_dbb);
|
||||
|
@ -878,7 +878,7 @@ static FIL setup_file(
|
||||
dbb->dbb_lock = lock = new(dbb->dbb_permanent, l) lck();
|
||||
lock->lck_type = LCK_database;
|
||||
lock->lck_owner_handle = LCK_get_owner_handle(NULL_TDBB, lock->lck_type);
|
||||
lock->lck_object = dbb;
|
||||
lock->lck_object = reinterpret_cast<blk*>(dbb);
|
||||
lock->lck_dbb = dbb;
|
||||
lock->lck_length = l;
|
||||
lock->lck_ast = CCH_down_grade_dbb;
|
||||
|
@ -690,7 +690,7 @@ static FIL setup_file(
|
||||
dbb->dbb_lock = lock = new(dbb->dbb_permanent, l) lck();
|
||||
lock->lck_type = LCK_database;
|
||||
lock->lck_owner_handle = LCK_get_owner_handle(NULL_TDBB, lock->lck_type);
|
||||
lock->lck_object = (BLK) dbb;
|
||||
lock->lck_object = reinterpret_cast<blk*>(dbb);
|
||||
lock->lck_length = l;
|
||||
lock->lck_dbb = dbb;
|
||||
lock->lck_ast = CCH_down_grade_dbb;
|
||||
|
@ -1110,7 +1110,7 @@ static FIL setup_file(DBB dbb,
|
||||
lock->lck_object = reinterpret_cast<blk*>(dbb);
|
||||
lock->lck_length = l;
|
||||
lock->lck_dbb = dbb;
|
||||
lock->lck_ast = reinterpret_cast<int (*)()> (CCH_down_grade_dbb);
|
||||
lock->lck_ast = reinterpret_cast<int (*)()>(CCH_down_grade_dbb);
|
||||
MOVE_FAST(lock_string, lock->lck_key.lck_string, l);
|
||||
|
||||
/* Try to get an exclusive lock on database. If this fails, insist
|
||||
|
@ -24,7 +24,7 @@
|
||||
*
|
||||
*/
|
||||
/*
|
||||
$Id: lock.cpp,v 1.6 2002-02-16 03:27:32 seanleyne Exp $
|
||||
$Id: lock.cpp,v 1.7 2002-03-31 00:39:01 tamlin Exp $
|
||||
*/
|
||||
|
||||
#include "firebird.h"
|
||||
@ -376,12 +376,12 @@ static CONST UCHAR compatibility[] = {
|
||||
#define COMPATIBLE(st1, st2) compatibility [st1 * LCK_max + st2]
|
||||
|
||||
|
||||
int LOCK_convert(
|
||||
PTR request_offset,
|
||||
UCHAR type,
|
||||
SSHORT lck_wait,
|
||||
int (*ast_routine) (void *),
|
||||
void *ast_argument, STATUS * status_vector)
|
||||
int LOCK_convert(PTR request_offset,
|
||||
UCHAR type,
|
||||
SSHORT lck_wait,
|
||||
int (*ast_routine) (void *),
|
||||
void* ast_argument,
|
||||
STATUS* status_vector)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -417,8 +417,9 @@ void *ast_argument, STATUS * status_vector)
|
||||
return convert(request_offset,
|
||||
type,
|
||||
lck_wait,
|
||||
reinterpret_cast < int (*)() > (ast_routine),
|
||||
static_cast < int *>(ast_argument), status_vector);
|
||||
reinterpret_cast<int (*)()>(ast_routine),
|
||||
static_cast<int*>(ast_argument),
|
||||
status_vector);
|
||||
}
|
||||
|
||||
|
||||
@ -615,8 +616,8 @@ SLONG LOCK_enq( PTR prior_request,
|
||||
request->lrq_state = LCK_none;
|
||||
request->lrq_data = 0;
|
||||
request->lrq_owner = owner_offset;
|
||||
request->lrq_ast_routine = reinterpret_cast < int (*) () > (ast_routine);
|
||||
request->lrq_ast_argument = static_cast < int *>(ast_argument);
|
||||
request->lrq_ast_routine = reinterpret_cast<int (*)()>(ast_routine);
|
||||
request->lrq_ast_argument = static_cast<int*>(ast_argument);
|
||||
insert_tail(&owner->own_requests, &request->lrq_own_requests);
|
||||
QUE_INIT(request->lrq_own_blocks);
|
||||
|
||||
@ -1291,8 +1292,8 @@ void LOCK_re_post( int (*ast) (void *), void *arg, PTR owner_offset)
|
||||
owner = (OWN) ABS_PTR(owner_offset);
|
||||
request->lrq_type = type_lrq;
|
||||
request->lrq_flags = LRQ_repost;
|
||||
request->lrq_ast_routine = reinterpret_cast < int (*) () > (ast);
|
||||
request->lrq_ast_argument = static_cast < int *>(arg);
|
||||
request->lrq_ast_routine = reinterpret_cast<int (*)()>(ast);
|
||||
request->lrq_ast_argument = static_cast<int*>(arg);
|
||||
request->lrq_requested = LCK_none;
|
||||
request->lrq_state = LCK_none;
|
||||
request->lrq_owner = owner_offset;
|
||||
@ -2084,12 +2085,12 @@ static void bug( STATUS * status_vector, CONST TEXT * string)
|
||||
}
|
||||
|
||||
|
||||
static BOOLEAN convert(
|
||||
PTR request_offset,
|
||||
UCHAR type,
|
||||
SSHORT lck_wait,
|
||||
int (*ast_routine) (),
|
||||
int *ast_argument, STATUS * status_vector)
|
||||
static BOOLEAN convert(PTR request_offset,
|
||||
UCHAR type,
|
||||
SSHORT lck_wait,
|
||||
int (*ast_routine)(),
|
||||
int* ast_argument,
|
||||
STATUS* status_vector)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -392,7 +392,9 @@ void SRVR_multi_thread( PORT main_port, USHORT flags)
|
||||
/* If port has an pending request, link this one in */
|
||||
|
||||
for (active = request_que; active; active = active->req_next)
|
||||
if (active->req_port == port) {
|
||||
{
|
||||
if (active->req_port == port)
|
||||
{
|
||||
/* Don't queue a dummy keepalive packet if there is
|
||||
a pending request against this port. */
|
||||
|
||||
@ -415,6 +417,7 @@ void SRVR_multi_thread( PORT main_port, USHORT flags)
|
||||
#endif
|
||||
goto finished;
|
||||
}
|
||||
}
|
||||
|
||||
/* No port to assign request to, add it to the waiting queue and wake up a
|
||||
* thread to handle it
|
||||
@ -3018,255 +3021,255 @@ BOOLEAN process_packet(PORT port,
|
||||
|
||||
try {
|
||||
|
||||
switch (op = receive->p_operation)
|
||||
{
|
||||
case op_connect:
|
||||
if (!accept_connection(port, &receive->p_cnct, send)) {
|
||||
if (string = port->port_user_name) {
|
||||
sprintf(msg,
|
||||
"SERVER/process_packet: connection rejected for %*.*s",
|
||||
string->str_length, string->str_length,
|
||||
string->str_data);
|
||||
gds__log(msg, 0);
|
||||
switch (op = receive->p_operation)
|
||||
{
|
||||
case op_connect:
|
||||
if (!accept_connection(port, &receive->p_cnct, send)) {
|
||||
if (string = port->port_user_name) {
|
||||
sprintf(msg,
|
||||
"SERVER/process_packet: connection rejected for %*.*s",
|
||||
string->str_length, string->str_length,
|
||||
string->str_data);
|
||||
gds__log(msg, 0);
|
||||
}
|
||||
if (port->port_server->srvr_flags & SRVR_multi_client)
|
||||
port->port_state = state_broken;
|
||||
else if (port->port_server->srvr_flags & SRVR_mpexl)
|
||||
port->port_state = state_pending;
|
||||
else {
|
||||
gds__log
|
||||
("SERVER/process_packet: connect reject, server exiting",
|
||||
0);
|
||||
THD_restore_specific();
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
if (port->port_server->srvr_flags & SRVR_multi_client)
|
||||
port->port_state = state_broken;
|
||||
else if (port->port_server->srvr_flags & SRVR_mpexl)
|
||||
port->port_state = state_pending;
|
||||
else {
|
||||
gds__log
|
||||
("SERVER/process_packet: connect reject, server exiting",
|
||||
0);
|
||||
THD_restore_specific();
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case op_compile:
|
||||
port->compile(&receive->p_cmpl, send);
|
||||
break;
|
||||
|
||||
case op_attach:
|
||||
case op_create:
|
||||
attach_database(port, op, &receive->p_atch, send);
|
||||
break;
|
||||
|
||||
case op_service_attach:
|
||||
port->service_attach(&receive->p_atch, send);
|
||||
break;
|
||||
|
||||
case op_service_start:
|
||||
port->service_start(&receive->p_info, send);
|
||||
break;
|
||||
|
||||
case op_disconnect:
|
||||
case op_exit:
|
||||
if (!(server = port->port_server))
|
||||
break;
|
||||
if ((server->srvr_flags & SRVR_multi_client) &&
|
||||
port != server->srvr_parent_port) {
|
||||
#ifdef XNET
|
||||
if (port->port_type == port_xnet) {
|
||||
|
||||
case op_compile:
|
||||
port->compile(&receive->p_cmpl, send);
|
||||
break;
|
||||
|
||||
case op_attach:
|
||||
case op_create:
|
||||
attach_database(port, op, &receive->p_atch, send);
|
||||
break;
|
||||
|
||||
case op_service_attach:
|
||||
port->service_attach(&receive->p_atch, send);
|
||||
break;
|
||||
|
||||
case op_service_start:
|
||||
port->service_start(&receive->p_info, send);
|
||||
break;
|
||||
|
||||
case op_disconnect:
|
||||
case op_exit:
|
||||
if (!(server = port->port_server))
|
||||
break;
|
||||
if ((server->srvr_flags & SRVR_multi_client) &&
|
||||
port != server->srvr_parent_port) {
|
||||
#ifdef XNET
|
||||
if (port->port_type == port_xnet) {
|
||||
port->disconnect(send, receive);
|
||||
THD_restore_specific();
|
||||
return FALSE;
|
||||
}
|
||||
#endif /* XNET */
|
||||
port->disconnect(send, receive);
|
||||
port = NULL;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
if ((server->srvr_flags & SRVR_multi_client) &&
|
||||
port == server->srvr_parent_port)
|
||||
gds__log
|
||||
("SERVER/process_packet: Multi-client server shutdown",
|
||||
0);
|
||||
port->disconnect(send, receive);
|
||||
THD_restore_specific();
|
||||
return FALSE;
|
||||
}
|
||||
#endif /* XNET */
|
||||
port->disconnect(send, receive);
|
||||
port = NULL;
|
||||
|
||||
case op_receive:
|
||||
port->receive_msg(&receive->p_data, send);
|
||||
break;
|
||||
|
||||
case op_send:
|
||||
port->send_msg(&receive->p_data, send);
|
||||
break;
|
||||
|
||||
case op_start:
|
||||
case op_start_and_receive:
|
||||
port->start(op, &receive->p_data, send);
|
||||
break;
|
||||
|
||||
case op_start_and_send:
|
||||
case op_start_send_and_receive:
|
||||
port->start_and_send(op, &receive->p_data, send);
|
||||
break;
|
||||
|
||||
case op_transact:
|
||||
port->transact_request(&receive->p_trrq, send);
|
||||
break;
|
||||
|
||||
case op_reconnect:
|
||||
case op_transaction:
|
||||
port->start_transaction(op, &receive->p_sttr, send);
|
||||
break;
|
||||
|
||||
case op_prepare:
|
||||
case op_rollback:
|
||||
case op_rollback_retaining:
|
||||
case op_commit:
|
||||
case op_commit_retaining:
|
||||
port->end_transaction(op, &receive->p_rlse, send);
|
||||
break;
|
||||
|
||||
case op_detach:
|
||||
port->end_database(&receive->p_rlse, send);
|
||||
break;
|
||||
|
||||
case op_service_detach:
|
||||
port->service_end(&receive->p_rlse, send);
|
||||
break;
|
||||
|
||||
case op_drop_database:
|
||||
port->drop_database(&receive->p_rlse, send);
|
||||
break;
|
||||
|
||||
case op_create_blob:
|
||||
case op_open_blob:
|
||||
case op_create_blob2:
|
||||
case op_open_blob2:
|
||||
port->open_blob(op, &receive->p_blob, send);
|
||||
break;
|
||||
|
||||
case op_batch_segments:
|
||||
case op_put_segment:
|
||||
port->put_segment(op, &receive->p_sgmt, send);
|
||||
break;
|
||||
|
||||
case op_get_segment:
|
||||
port->get_segment(&receive->p_sgmt, send);
|
||||
break;
|
||||
|
||||
case op_seek_blob:
|
||||
port->seek_blob(&receive->p_seek, send);
|
||||
break;
|
||||
|
||||
case op_cancel_blob:
|
||||
case op_close_blob:
|
||||
port->end_blob(op, &receive->p_rlse, send);
|
||||
break;
|
||||
|
||||
case op_prepare2:
|
||||
port->prepare(&receive->p_prep, send);
|
||||
break;
|
||||
|
||||
case op_release:
|
||||
port->end_request(&receive->p_rlse, send);
|
||||
break;
|
||||
|
||||
case op_info_blob:
|
||||
case op_info_database:
|
||||
case op_info_request:
|
||||
case op_info_transaction:
|
||||
case op_service_info:
|
||||
case op_info_sql:
|
||||
port->info(op, &receive->p_info, send);
|
||||
break;
|
||||
|
||||
case op_que_events:
|
||||
port->que_events(&receive->p_event, send);
|
||||
break;
|
||||
|
||||
case op_cancel_events:
|
||||
cancel_events(port, &receive->p_event, send);
|
||||
break;
|
||||
|
||||
case op_connect_request:
|
||||
aux_request(port, &receive->p_req, send);
|
||||
break;
|
||||
|
||||
case op_aux_connect:
|
||||
aux_connect(port, &receive->p_req, send);
|
||||
break;
|
||||
|
||||
case op_ddl:
|
||||
port->ddl(&receive->p_ddl, send);
|
||||
break;
|
||||
|
||||
case op_get_slice:
|
||||
port->get_slice(&receive->p_slc, send);
|
||||
break;
|
||||
|
||||
case op_put_slice:
|
||||
port->put_slice(&receive->p_slc, send);
|
||||
break;
|
||||
|
||||
case op_allocate_statement:
|
||||
allocate_statement(port, &receive->p_rlse, send);
|
||||
break;
|
||||
|
||||
case op_execute:
|
||||
case op_execute2:
|
||||
port->execute_statement(op, &receive->p_sqldata, send);
|
||||
break;
|
||||
|
||||
case op_exec_immediate:
|
||||
case op_exec_immediate2:
|
||||
port->execute_immediate(op, &receive->p_sqlst, send);
|
||||
break;
|
||||
|
||||
case op_fetch:
|
||||
port->fetch(&receive->p_sqldata, send);
|
||||
break;
|
||||
|
||||
case op_free_statement:
|
||||
port->end_statement(&receive->p_sqlfree, send);
|
||||
break;
|
||||
|
||||
case op_insert:
|
||||
port->insert(&receive->p_sqldata, send);
|
||||
break;
|
||||
|
||||
case op_prepare_statement:
|
||||
port->prepare_statement(&receive->p_sqlst, send);
|
||||
break;
|
||||
|
||||
case op_set_cursor:
|
||||
port->set_cursor(&receive->p_sqlcur, send);
|
||||
break;
|
||||
|
||||
case op_dummy:
|
||||
send->p_operation = op_dummy;
|
||||
port->send(send);
|
||||
break;
|
||||
|
||||
default:
|
||||
sprintf(msg, "SERVER/process_packet: don't understand packet type %d",
|
||||
receive->p_operation);
|
||||
gds__log(msg, 0);
|
||||
port->port_state = state_broken;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
if ((server->srvr_flags & SRVR_multi_client) &&
|
||||
port == server->srvr_parent_port)
|
||||
gds__log
|
||||
("SERVER/process_packet: Multi-client server shutdown",
|
||||
0);
|
||||
|
||||
if (port && port->port_state == state_broken) {
|
||||
if (!port->port_parent) {
|
||||
gds__log("SERVER/process_packet: broken port, server exiting", 0);
|
||||
port->disconnect();
|
||||
THD_restore_specific();
|
||||
return FALSE;
|
||||
}
|
||||
port->disconnect(send, receive);
|
||||
THD_restore_specific();
|
||||
return FALSE;
|
||||
port = NULL;
|
||||
}
|
||||
|
||||
case op_receive:
|
||||
port->receive_msg(&receive->p_data, send);
|
||||
break;
|
||||
if (result)
|
||||
*result = port;
|
||||
|
||||
case op_send:
|
||||
port->send_msg(&receive->p_data, send);
|
||||
break;
|
||||
|
||||
case op_start:
|
||||
case op_start_and_receive:
|
||||
port->start(op, &receive->p_data, send);
|
||||
break;
|
||||
|
||||
case op_start_and_send:
|
||||
case op_start_send_and_receive:
|
||||
port->start_and_send(op, &receive->p_data, send);
|
||||
break;
|
||||
|
||||
case op_transact:
|
||||
port->transact_request(&receive->p_trrq, send);
|
||||
break;
|
||||
|
||||
case op_reconnect:
|
||||
case op_transaction:
|
||||
port->start_transaction(op, &receive->p_sttr, send);
|
||||
break;
|
||||
|
||||
case op_prepare:
|
||||
case op_rollback:
|
||||
case op_rollback_retaining:
|
||||
case op_commit:
|
||||
case op_commit_retaining:
|
||||
port->end_transaction(op, &receive->p_rlse, send);
|
||||
break;
|
||||
|
||||
case op_detach:
|
||||
port->end_database(&receive->p_rlse, send);
|
||||
break;
|
||||
|
||||
case op_service_detach:
|
||||
port->service_end(&receive->p_rlse, send);
|
||||
break;
|
||||
|
||||
case op_drop_database:
|
||||
port->drop_database(&receive->p_rlse, send);
|
||||
break;
|
||||
|
||||
case op_create_blob:
|
||||
case op_open_blob:
|
||||
case op_create_blob2:
|
||||
case op_open_blob2:
|
||||
port->open_blob(op, &receive->p_blob, send);
|
||||
break;
|
||||
|
||||
case op_batch_segments:
|
||||
case op_put_segment:
|
||||
port->put_segment(op, &receive->p_sgmt, send);
|
||||
break;
|
||||
|
||||
case op_get_segment:
|
||||
port->get_segment(&receive->p_sgmt, send);
|
||||
break;
|
||||
|
||||
case op_seek_blob:
|
||||
port->seek_blob(&receive->p_seek, send);
|
||||
break;
|
||||
|
||||
case op_cancel_blob:
|
||||
case op_close_blob:
|
||||
port->end_blob(op, &receive->p_rlse, send);
|
||||
break;
|
||||
|
||||
case op_prepare2:
|
||||
port->prepare(&receive->p_prep, send);
|
||||
break;
|
||||
|
||||
case op_release:
|
||||
port->end_request(&receive->p_rlse, send);
|
||||
break;
|
||||
|
||||
case op_info_blob:
|
||||
case op_info_database:
|
||||
case op_info_request:
|
||||
case op_info_transaction:
|
||||
case op_service_info:
|
||||
case op_info_sql:
|
||||
port->info(op, &receive->p_info, send);
|
||||
break;
|
||||
|
||||
case op_que_events:
|
||||
port->que_events(&receive->p_event, send);
|
||||
break;
|
||||
|
||||
case op_cancel_events:
|
||||
cancel_events(port, &receive->p_event, send);
|
||||
break;
|
||||
|
||||
case op_connect_request:
|
||||
aux_request(port, &receive->p_req, send);
|
||||
break;
|
||||
|
||||
case op_aux_connect:
|
||||
aux_connect(port, &receive->p_req, send);
|
||||
break;
|
||||
|
||||
case op_ddl:
|
||||
port->ddl(&receive->p_ddl, send);
|
||||
break;
|
||||
|
||||
case op_get_slice:
|
||||
port->get_slice(&receive->p_slc, send);
|
||||
break;
|
||||
|
||||
case op_put_slice:
|
||||
port->put_slice(&receive->p_slc, send);
|
||||
break;
|
||||
|
||||
case op_allocate_statement:
|
||||
allocate_statement(port, &receive->p_rlse, send);
|
||||
break;
|
||||
|
||||
case op_execute:
|
||||
case op_execute2:
|
||||
port->execute_statement(op, &receive->p_sqldata, send);
|
||||
break;
|
||||
|
||||
case op_exec_immediate:
|
||||
case op_exec_immediate2:
|
||||
port->execute_immediate(op, &receive->p_sqlst, send);
|
||||
break;
|
||||
|
||||
case op_fetch:
|
||||
port->fetch(&receive->p_sqldata, send);
|
||||
break;
|
||||
|
||||
case op_free_statement:
|
||||
port->end_statement(&receive->p_sqlfree, send);
|
||||
break;
|
||||
|
||||
case op_insert:
|
||||
port->insert(&receive->p_sqldata, send);
|
||||
break;
|
||||
|
||||
case op_prepare_statement:
|
||||
port->prepare_statement(&receive->p_sqlst, send);
|
||||
break;
|
||||
|
||||
case op_set_cursor:
|
||||
port->set_cursor(&receive->p_sqlcur, send);
|
||||
break;
|
||||
|
||||
case op_dummy:
|
||||
send->p_operation = op_dummy;
|
||||
port->send(send);
|
||||
break;
|
||||
|
||||
default:
|
||||
sprintf(msg, "SERVER/process_packet: don't understand packet type %d",
|
||||
receive->p_operation);
|
||||
gds__log(msg, 0);
|
||||
port->port_state = state_broken;
|
||||
break;
|
||||
}
|
||||
|
||||
if (port && port->port_state == state_broken) {
|
||||
if (!port->port_parent) {
|
||||
gds__log("SERVER/process_packet: broken port, server exiting", 0);
|
||||
port->disconnect();
|
||||
THD_restore_specific();
|
||||
return FALSE;
|
||||
}
|
||||
port->disconnect(send, receive);
|
||||
port = NULL;
|
||||
}
|
||||
|
||||
if (result)
|
||||
*result = port;
|
||||
|
||||
THD_restore_specific();
|
||||
THD_restore_specific();
|
||||
|
||||
} // try
|
||||
catch (...) {
|
||||
@ -4743,7 +4746,7 @@ static void success( STATUS * status_vector)
|
||||
}
|
||||
|
||||
|
||||
static int THREAD_ROUTINE thread( void *flags)
|
||||
static int THREAD_ROUTINE thread(void* flags)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -4776,17 +4779,20 @@ static int THREAD_ROUTINE thread( void *flags)
|
||||
timedout_count = 0;
|
||||
THREAD_ENTER;
|
||||
|
||||
for (;;) {
|
||||
for (;;)
|
||||
{
|
||||
value = ISC_event_clear(thread_event);
|
||||
if (request = request_que) {
|
||||
if (request = request_que)
|
||||
{
|
||||
inactive_count = 0;
|
||||
timedout_count = 0;
|
||||
request_que = request->req_next;
|
||||
while (request) {
|
||||
while (request)
|
||||
{
|
||||
/* Bind a thread to a port. */
|
||||
|
||||
if (request->req_port->
|
||||
port_server_flags & SRVR_thread_per_port) {
|
||||
if (request->req_port->port_server_flags & SRVR_thread_per_port)
|
||||
{
|
||||
port = request->req_port;
|
||||
request->req_next = free_requests;
|
||||
free_requests = request;
|
||||
@ -4804,15 +4810,17 @@ static int THREAD_ROUTINE thread( void *flags)
|
||||
|
||||
/* Validate port. If it looks ok, process request */
|
||||
|
||||
parent_port =
|
||||
request->req_port->port_server->srvr_parent_port;
|
||||
if (parent_port == request->req_port) {
|
||||
parent_port = request->req_port->port_server->srvr_parent_port;
|
||||
if (parent_port == request->req_port)
|
||||
{
|
||||
process_packet(parent_port, &request->req_send,
|
||||
&request->req_receive, &port);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (port = parent_port->port_clients; port;
|
||||
port = port->port_next)
|
||||
{
|
||||
|
||||
if (port == request->req_port
|
||||
&& port->port_state != state_disconnected) {
|
||||
@ -4820,20 +4828,25 @@ static int THREAD_ROUTINE thread( void *flags)
|
||||
&request->req_receive, &port);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Take request out of list of active requests */
|
||||
|
||||
for (req_ptr = &active_requests; *req_ptr;
|
||||
req_ptr = &(*req_ptr)->req_next)
|
||||
{
|
||||
if (*req_ptr == request) {
|
||||
*req_ptr = request->req_next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If this is a explicit or implicit disconnect, get rid of
|
||||
any chained requests */
|
||||
|
||||
if (!port) {
|
||||
if (!port)
|
||||
{
|
||||
while (next = request->req_chain) {
|
||||
request->req_chain = next->req_chain;
|
||||
next->req_next = free_requests;
|
||||
@ -4862,7 +4875,7 @@ static int THREAD_ROUTINE thread( void *flags)
|
||||
free_requests = request;
|
||||
request = next;
|
||||
}
|
||||
}
|
||||
} // while (request)
|
||||
}
|
||||
else {
|
||||
inactive_count++;
|
||||
|
Loading…
Reference in New Issue
Block a user