From: <di...@us...> - 2012-01-03 18:06:49
|
Revision: 53808 http://firebird.svn.sourceforge.net/firebird/?rev=53808&view=rev Author: dimitr Date: 2012-01-03 18:06:42 +0000 (Tue, 03 Jan 2012) Log Message: ----------- Removed the outdated RPC support + some misc cleanup. Modified Paths: -------------- firebird/trunk/src/remote/client/interface.cpp firebird/trunk/src/remote/inet.cpp firebird/trunk/src/remote/os/win32/wnet.cpp firebird/trunk/src/remote/os/win32/xnet.cpp firebird/trunk/src/remote/protocol.h firebird/trunk/src/remote/remote.h firebird/trunk/src/remote/server/server.cpp Modified: firebird/trunk/src/remote/client/interface.cpp =================================================================== --- firebird/trunk/src/remote/client/interface.cpp 2012-01-03 16:14:41 UTC (rev 53807) +++ firebird/trunk/src/remote/client/interface.cpp 2012-01-03 18:06:42 UTC (rev 53808) @@ -868,8 +868,7 @@ rem_port* port = rdb->rdb_port; RefMutexGuard portGuard(*port->port_sync); - if (!(port->port_flags & PORT_rpc) && - (blob->rbl_flags & Rbl::CREATE) && blob->rbl_ptr != blob->rbl_buffer) + if ((blob->rbl_flags & Rbl::CREATE) && blob->rbl_ptr != blob->rbl_buffer) { send_blob(status, blob, 0, NULL); } @@ -2088,8 +2087,6 @@ ( // Low in inventory (statement->rsr_rows_pending <= statement->rsr_reorder_level) && (statement->rsr_msgs_waiting <= statement->rsr_reorder_level) && - // doing Batch, not RPC - !(port->port_flags & PORT_rpc) && // not using named pipe on NT // Pipelining causes both server & client to // write at the same time. In named pipes, writes @@ -2112,23 +2109,21 @@ sqldata->p_sqldata_blr.cstr_length = blr_length; sqldata->p_sqldata_blr.cstr_address = const_cast<unsigned char*>(blr); sqldata->p_sqldata_message_number = 0; // msg_type - if (sqldata->p_sqldata_messages = statement->rsr_select_format ? 1 : 0) + sqldata->p_sqldata_messages = 0; + if (statement->rsr_select_format) { - if (!(port->port_flags & PORT_rpc)) - { - sqldata->p_sqldata_messages = - static_cast<USHORT>(REMOTE_compute_batch_size(port, - 0, op_fetch_response, statement->rsr_select_format)); - sqldata->p_sqldata_messages *= 4; + sqldata->p_sqldata_messages = + static_cast<USHORT>(REMOTE_compute_batch_size(port, + 0, op_fetch_response, statement->rsr_select_format)); + sqldata->p_sqldata_messages *= 4; - // Reorder data when the local buffer is half empty + // Reorder data when the local buffer is half empty - statement->rsr_reorder_level = sqldata->p_sqldata_messages / 2; + statement->rsr_reorder_level = sqldata->p_sqldata_messages / 2; #ifdef DEBUG - fprintf(stdout, "Recalculating Rows Pending in REM_fetch=%lu\n", - statement->rsr_rows_pending); + fprintf(stdout, "Recalculating Rows Pending in REM_fetch=%lu\n", + statement->rsr_rows_pending); #endif - } } statement->rsr_rows_pending += sqldata->p_sqldata_messages; @@ -2884,10 +2879,9 @@ P_RESP* response = &packet->p_resp; CSTRING temp = response->p_resp_data; - // Handle old protocol. Also handle new protocol on a blob that has - // been created rather than opened. (This should yield an error.) + // Handle a blob that has been created rather than opened (this should yield an error) - if ((port->port_flags & PORT_rpc) || (blob->rbl_flags & Rbl::CREATE)) + if (blob->rbl_flags & Rbl::CREATE) { packet->p_operation = op_get_segment; segment->p_sgmt_length = buffer_length; @@ -3309,11 +3303,9 @@ rem_port* port = rdb->rdb_port; RefMutexGuard portGuard(*port->port_sync); - // If this is an ancient protocol, just send the segment. - // Also handle the new protocol on a blob that has been - // opened rather than created. (This should yield an error.) + // Handle a blob that has been opened rather than created (this should yield an error) - if ((port->port_flags & PORT_rpc) || !(blob->rbl_flags & Rbl::CREATE)) + if (!(blob->rbl_flags & Rbl::CREATE)) { send_blob(status, blob, segment_length, segmentPtr); fb_assert(false); @@ -3578,7 +3570,6 @@ ((!message->msg_address && tail->rrq_rows_pending == 0) || // No message waiting (tail->rrq_rows_pending <= tail->rrq_reorder_level && // Low in inventory tail->rrq_msgs_waiting <= tail->rrq_reorder_level && - !(port->port_flags & PORT_rpc) && // doing Batch, not RPC // Pipelining causes both server & client to // write at the same time. In named pipes, writes // block for the other end to read - and so when both @@ -3611,26 +3602,16 @@ // is the same for each batch (June 1996), perhaps in the future it // could dynamically adjust batching sizes based on fetch patterns - if (port->port_flags & PORT_rpc) - { - // This is an RPC (remote procedure call) port - we just do - // one at a time processing as that's how RPC works. + data->p_data_messages = + static_cast<USHORT>(REMOTE_compute_batch_size(port, 0, op_send, tail->rrq_format)); + tail->rrq_reorder_level = 2 * data->p_data_messages; + data->p_data_messages *= 4; + tail->rrq_rows_pending += data->p_data_messages; - data->p_data_messages = 1; - } - else - { - data->p_data_messages = - static_cast<USHORT>(REMOTE_compute_batch_size(port, 0, op_send, tail->rrq_format)); - tail->rrq_reorder_level = 2 * data->p_data_messages; - data->p_data_messages *= 4; - tail->rrq_rows_pending += data->p_data_messages; - #ifdef DEBUG - fprintf(stdout, "Recalculating Rows Pending in REM_receive=%d\n", - tail->rrq_rows_pending); + fprintf(stdout, "Recalculating Rows Pending in REM_receive=%d\n", + tail->rrq_rows_pending); #endif - } #ifdef DEBUG fprintf(stderr, "port_flags %d max_msg %d\n", port->port_flags, request->rrq_max_msg); @@ -5191,8 +5172,7 @@ // See if we're at end of the batch - if (packet->p_sqldata.p_sqldata_status || !packet->p_sqldata.p_sqldata_messages || - (port->port_flags & PORT_rpc)) + if (packet->p_sqldata.p_sqldata_status || !packet->p_sqldata.p_sqldata_messages) { if (packet->p_sqldata.p_sqldata_status == 100) { @@ -5358,7 +5338,7 @@ // See if we're at end of the batch - if (!packet->p_data.p_data_messages || (port->port_flags & PORT_rpc)) + if (!packet->p_data.p_data_messages) { if (!(--tail->rrq_batch_count)) tail->rrq_rows_pending = 0; @@ -6115,9 +6095,8 @@ // Reached end of batch - if (!packet->p_data.p_data_messages || (port->port_flags & PORT_rpc)) { + if (!packet->p_data.p_data_messages) break; - } } } Modified: firebird/trunk/src/remote/inet.cpp =================================================================== --- firebird/trunk/src/remote/inet.cpp 2012-01-03 16:14:41 UTC (rev 53807) +++ firebird/trunk/src/remote/inet.cpp 2012-01-03 18:06:42 UTC (rev 53808) @@ -597,11 +597,11 @@ static const p_cnct::p_cnct_repeat protocols_to_try1[] = { - REMOTE_PROTOCOL(PROTOCOL_VERSION8, ptype_rpc, ptype_lazy_send, 1), - REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_rpc, ptype_lazy_send, 2), - REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_rpc, ptype_lazy_send, 3), - REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_rpc, ptype_lazy_send, 4), - REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_rpc, ptype_lazy_send, 5) + REMOTE_PROTOCOL(PROTOCOL_VERSION8, ptype_lazy_send, 1), + REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_lazy_send, 2), + REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_lazy_send, 3), + REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_lazy_send, 4), + REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_lazy_send, 5) }; cnct->p_cnct_count = FB_NELEM(protocols_to_try1); @@ -623,8 +623,8 @@ static const p_cnct::p_cnct_repeat protocols_to_try2[] = { - REMOTE_PROTOCOL(PROTOCOL_VERSION6, ptype_rpc, ptype_batch_send, 1), - REMOTE_PROTOCOL(PROTOCOL_VERSION7, ptype_rpc, ptype_lazy_send, 2) + REMOTE_PROTOCOL(PROTOCOL_VERSION6, ptype_batch_send, 1), + REMOTE_PROTOCOL(PROTOCOL_VERSION7, ptype_lazy_send, 2) }; cnct->p_cnct_count = FB_NELEM(protocols_to_try2); @@ -691,10 +691,6 @@ port->port_flags |= PORT_symmetric; } - if (accept->p_acpt_type == ptype_rpc) { - port->port_flags |= PORT_rpc; - } - if (accept->p_acpt_type != ptype_out_of_band) { port->port_flags |= PORT_no_oob; } @@ -1199,7 +1195,6 @@ if (user_verification) { eff_gid = eff_uid = -1; - // port->port_flags |= PORT_not_trusted; // never tested } #ifndef WIN_NT Modified: firebird/trunk/src/remote/os/win32/wnet.cpp =================================================================== --- firebird/trunk/src/remote/os/win32/wnet.cpp 2012-01-03 16:14:41 UTC (rev 53807) +++ firebird/trunk/src/remote/os/win32/wnet.cpp 2012-01-03 18:06:42 UTC (rev 53808) @@ -176,12 +176,12 @@ static const p_cnct::p_cnct_repeat protocols_to_try1[] = { - REMOTE_PROTOCOL(PROTOCOL_VERSION7, ptype_rpc, ptype_batch_send, 1), - REMOTE_PROTOCOL(PROTOCOL_VERSION8, ptype_rpc, ptype_batch_send, 2), - REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_rpc, ptype_batch_send, 3), - REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_rpc, ptype_batch_send, 4), - REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_rpc, ptype_batch_send, 5), - REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_rpc, ptype_batch_send, 6) + REMOTE_PROTOCOL(PROTOCOL_VERSION7, ptype_batch_send, 1), + REMOTE_PROTOCOL(PROTOCOL_VERSION8, ptype_batch_send, 2), + REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_batch_send, 3), + REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_batch_send, 4), + REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_batch_send, 5), + REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_batch_send, 6) }; cnct->p_cnct_count = FB_NELEM(protocols_to_try1); @@ -225,8 +225,8 @@ static const p_cnct::p_cnct_repeat protocols_to_try2[] = { - REMOTE_PROTOCOL(PROTOCOL_VERSION4, ptype_rpc, ptype_batch_send, 1), - REMOTE_PROTOCOL(PROTOCOL_VERSION6, ptype_rpc, ptype_batch_send, 2), + REMOTE_PROTOCOL(PROTOCOL_VERSION4, ptype_batch_send, 1), + REMOTE_PROTOCOL(PROTOCOL_VERSION6, ptype_batch_send, 2), }; cnct->p_cnct_count = FB_NELEM(protocols_to_try2); @@ -268,7 +268,7 @@ static const p_cnct::p_cnct_repeat protocols_to_try3[] = { - REMOTE_PROTOCOL(PROTOCOL_VERSION3, ptype_rpc, ptype_batch_send, 1) + REMOTE_PROTOCOL(PROTOCOL_VERSION3, ptype_batch_send, 1) }; cnct->p_cnct_count = FB_NELEM(protocols_to_try3); @@ -351,9 +351,6 @@ if (accept->p_acpt_architecture == ARCHITECTURE) port->port_flags |= PORT_symmetric; - if (accept->p_acpt_type == ptype_rpc) - port->port_flags |= PORT_rpc; - if (accept->p_acpt_type != ptype_out_of_band) port->port_flags |= PORT_no_oob; Modified: firebird/trunk/src/remote/os/win32/xnet.cpp =================================================================== --- firebird/trunk/src/remote/os/win32/xnet.cpp 2012-01-03 16:14:41 UTC (rev 53807) +++ firebird/trunk/src/remote/os/win32/xnet.cpp 2012-01-03 18:06:42 UTC (rev 53808) @@ -258,12 +258,12 @@ static const p_cnct::p_cnct_repeat protocols_to_try1[] = { - REMOTE_PROTOCOL(PROTOCOL_VERSION7, ptype_rpc, ptype_batch_send, 1), - REMOTE_PROTOCOL(PROTOCOL_VERSION8, ptype_rpc, ptype_batch_send, 2), - REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_rpc, ptype_batch_send, 3), - REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_rpc, ptype_batch_send, 4), - REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_rpc, ptype_batch_send, 5), - REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_rpc, ptype_batch_send, 6) + REMOTE_PROTOCOL(PROTOCOL_VERSION7, ptype_batch_send, 1), + REMOTE_PROTOCOL(PROTOCOL_VERSION8, ptype_batch_send, 2), + REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_batch_send, 3), + REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_batch_send, 4), + REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_batch_send, 5), + REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_batch_send, 6) }; cnct->p_cnct_count = FB_NELEM(protocols_to_try1); @@ -307,8 +307,8 @@ static const p_cnct::p_cnct_repeat protocols_to_try2[] = { - REMOTE_PROTOCOL(PROTOCOL_VERSION4, ptype_rpc, ptype_batch_send, 1), - REMOTE_PROTOCOL(PROTOCOL_VERSION6, ptype_rpc, ptype_batch_send, 2), + REMOTE_PROTOCOL(PROTOCOL_VERSION4, ptype_batch_send, 1), + REMOTE_PROTOCOL(PROTOCOL_VERSION6, ptype_batch_send, 2), }; cnct->p_cnct_count = FB_NELEM(protocols_to_try2); @@ -350,7 +350,7 @@ static const p_cnct::p_cnct_repeat protocols_to_try3[] = { - REMOTE_PROTOCOL(PROTOCOL_VERSION3, ptype_rpc, ptype_batch_send, 1) + REMOTE_PROTOCOL(PROTOCOL_VERSION3, ptype_batch_send, 1) }; cnct->p_cnct_count = FB_NELEM(protocols_to_try3); @@ -434,9 +434,6 @@ if (accept->p_acpt_architecture == ARCHITECTURE) port->port_flags |= PORT_symmetric; - if (accept->p_acpt_type == ptype_rpc) - port->port_flags |= PORT_rpc; - if (accept->p_acpt_type != ptype_out_of_band) port->port_flags |= PORT_no_oob; Modified: firebird/trunk/src/remote/protocol.h =================================================================== --- firebird/trunk/src/remote/protocol.h 2012-01-03 16:14:41 UTC (rev 53807) +++ firebird/trunk/src/remote/protocol.h 2012-01-03 18:06:42 UTC (rev 53808) @@ -159,7 +159,7 @@ // Protocol Types // p_acpt_type //const USHORT ptype_page = 1; // Page server protocol -const USHORT ptype_rpc = 2; // Simple remote procedure call +//const USHORT ptype_rpc = 2; // Simple remote procedure call const USHORT ptype_batch_send = 3; // Batch sends, no asynchrony const USHORT ptype_out_of_band = 4; // Batch sends w/ out of band notification const USHORT ptype_lazy_send = 5; // Deferred packets delivery @@ -371,12 +371,12 @@ } P_CNCT; #ifdef ASYMMETRIC_PROTOCOLS_ONLY -#define REMOTE_PROTOCOL(version, min_type, max_type, weight) \ - {version, arch_generic, min_type, max_type, weight * 2} +#define REMOTE_PROTOCOL(version, max_type, weight) \ + {version, arch_generic, ptype_batch_send, max_type, weight * 2} #else -#define REMOTE_PROTOCOL(version, min_type, max_type, weight) \ - {version, arch_generic, min_type, max_type, weight * 2}, \ - {version, ARCHITECTURE, min_type, max_type, weight * 2 + 1} +#define REMOTE_PROTOCOL(version, max_type, weight) \ + {version, arch_generic, ptype_batch_send, max_type, weight * 2}, \ + {version, ARCHITECTURE, ptype_batch_send, max_type, weight * 2 + 1} #endif /* User identification data, if any, is of form: Modified: firebird/trunk/src/remote/remote.h =================================================================== --- firebird/trunk/src/remote/remote.h 2012-01-03 16:14:41 UTC (rev 53807) +++ firebird/trunk/src/remote/remote.h 2012-01-03 18:06:42 UTC (rev 53808) @@ -700,18 +700,15 @@ // port_flags const USHORT PORT_symmetric = 0x0001; // Server/client architectures are symmetic -const USHORT PORT_rpc = 0x0002; // Protocol is remote procedure call -const USHORT PORT_async = 0x0004; // Port is asynchronous channel for events -const USHORT PORT_no_oob = 0x0008; // Don't send out of band data -const USHORT PORT_disconnect = 0x0010; // Disconnect is in progress -// This is set only in inet.cpp but never tested -//const USHORT PORT_not_trusted = 0x0020; // Connection is from an untrusted node -const USHORT PORT_dummy_pckt_set= 0x0040; // A dummy packet interval is set -const USHORT PORT_partial_data = 0x0080; // Physical packet doesn't contain all API packet -const USHORT PORT_lazy = 0x0100; // Deferred operations are allowed -const USHORT PORT_server = 0x0200; // Server (not client) port -const USHORT PORT_detached = 0x0400; // op_detach, op_drop_database or op_service_detach was processed -const USHORT PORT_rdb_shutdown = 0x0800; // Database is shut down +const USHORT PORT_async = 0x0002; // Port is asynchronous channel for events +const USHORT PORT_no_oob = 0x0004; // Don't send out of band data +const USHORT PORT_disconnect = 0x0008; // Disconnect is in progress +const USHORT PORT_dummy_pckt_set= 0x0010; // A dummy packet interval is set +const USHORT PORT_partial_data = 0x0020; // Physical packet doesn't contain all API packet +const USHORT PORT_lazy = 0x0040; // Deferred operations are allowed +const USHORT PORT_server = 0x0080; // Server (not client) port +const USHORT PORT_detached = 0x0100; // op_detach, op_drop_database or op_service_detach was processed +const USHORT PORT_rdb_shutdown = 0x0200; // Database is shut down // Port itself Modified: firebird/trunk/src/remote/server/server.cpp =================================================================== --- firebird/trunk/src/remote/server/server.cpp 2012-01-03 16:14:41 UTC (rev 53807) +++ firebird/trunk/src/remote/server/server.cpp 2012-01-03 18:06:42 UTC (rev 53808) @@ -645,9 +645,6 @@ static void trusted_auth(rem_port*, const P_TRAU*, PACKET*); static void continue_authentication(rem_port*, const p_auth_continue*, PACKET*); -#ifdef NOT_USED_OR_REPLACED -static void aux_connect(rem_port*, P_REQ*, PACKET*); -#endif static void aux_request(rem_port*, /*P_REQ*,*/ PACKET*); static bool bad_port_context(IStatus*, IRefCounted*, const ISC_STATUS); static ISC_STATUS cancel_events(rem_port*, P_EVENT*, PACKET*); @@ -1457,9 +1454,6 @@ if (architecture == ARCHITECTURE) port->port_flags |= PORT_symmetric; - if (type == ptype_rpc) - port->port_flags |= PORT_rpc; - if (type != ptype_out_of_band) port->port_flags |= PORT_no_oob; @@ -1722,30 +1716,6 @@ } -#ifdef NOT_USED_OR_REPLACED -static void aux_connect( rem_port* port, P_REQ * request, PACKET* send) -{ -/************************************** - * - * a u x _ c o n n e c t - * - ************************************** - * - * Functional description - * We're receive a auxiliary connection on the main communications - * channel. Accept connection and reply politely. - * - * 13-Mar-2004, Nickolay Samofatov - * This code is 64-bit unsafe, unused and also has a security hole, thus I disable it for now - * - **************************************/ - port->connect(0); - rem_port* partner = (rem_port*) request->p_req_partner; - partner->port_async = port; -} -#endif - - static void aux_request( rem_port* port, /*P_REQ* request,*/ PACKET* send) { /************************************** @@ -2747,8 +2717,7 @@ else { msg_length = 0; } - USHORT count = ((this->port_flags & PORT_rpc) || statement->rsr_flags.test(Rsr::NO_BATCH)) ? - 1 : sqldata->p_sqldata_messages; + USHORT count = statement->rsr_flags.test(Rsr::NO_BATCH) ? 1 : sqldata->p_sqldata_messages; USHORT count2 = statement->rsr_flags.test(Rsr::NO_BATCH) ? 0 : count; // On first fetch, clear the end-of-stream flag & reset the message buffers @@ -3075,25 +3044,10 @@ #endif sendL->p_resp.p_resp_data.cstr_address = buffer; - // Be backwards compatible + // Gobble up a buffer's worth of segments LocalStatus status_vector; - if (this->port_flags & PORT_rpc) - { - USHORT length = blob->rbl_iface->getSegment(&status_vector, segment->p_sgmt_length, buffer); - - const ISC_STATUS status = - this->send_response(sendL, blob->rbl_id, length, &status_vector, false); -#ifdef DEBUG_REMOTE_MEMORY - printf("get_segment(server) free buffer %x\n", buffer); -#endif - - return status; - } - - // Gobble up a buffer's worth of segments - UCHAR* p = buffer; ISC_STATUS state = 0; @@ -3945,12 +3899,6 @@ aux_request(port, /*&receive->p_req,*/ sendL); break; -#ifdef NOT_USED_OR_REPLACED - case op_aux_connect: - aux_connect(port, &receive->p_req, sendL); - break; -#endif - case op_ddl: port->ddl(&receive->p_ddl, sendL); break; @@ -4302,15 +4250,8 @@ const rem_fmt* format = tail->rrq_format; data->p_data_message_number = msg_number; - if (this->port_flags & PORT_rpc) - { - data->p_data_messages = 1; - } - else - { - data->p_data_messages = (USHORT) REMOTE_compute_batch_size(this, - (USHORT) xdr_protocol_overhead(op_response_piggyback), op_send, format); - } + data->p_data_messages = (USHORT) REMOTE_compute_batch_size(this, + (USHORT) xdr_protocol_overhead(op_response_piggyback), op_send, format); return this->receive_msg(data, sendL); } @@ -4340,7 +4281,7 @@ requestL = REMOTE_find_request(requestL, level); const USHORT msg_number = data->p_data_message_number; USHORT count, count2; - count2 = count = (this->port_flags & PORT_rpc) ? 1 : data->p_data_messages; + count2 = count = data->p_data_messages; LocalStatus status_vector; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |