Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit f2607bb

Browse files
Tianyi Chenapavlo
authored andcommitted
change function name, bind database name at the begining
1 parent 60660f2 commit f2607bb

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

src/include/network/postgres_protocol_handler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class PostgresProtocolHandler : public ProtocolHandler {
7878
static bool ReadPacket(Buffer &rbuf, InputPacket &rpkt);
7979

8080
/* Routine to deal with the first packet from the client */
81-
bool ProcessInitialPacket(InputPacket* pkt, Client client, bool ssl_able, bool& ssl_sent, bool& finish_startup_packet);
81+
bool ProcessInitialPackets(InputPacket* pkt, Client client, bool ssl_able, bool& ssl_sent, bool& finish_startup_packet);
8282

8383
/* Routine to deal with SSL request message */
8484
void ProcessSSLRequestPacket(bool ssl_able, bool& ssl_handshake);

src/include/network/protocol_handler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class ProtocolHandler {
3636
// bool ManageStartupPacket();
3737
virtual void SendInitialResponse();
3838

39-
virtual bool ProcessInitialPacket(InputPacket* pkt, Client client, bool ssl_able, bool& ssl_sent, bool& finish_startup_packet) = 0;
39+
virtual bool ProcessInitialPackets(InputPacket* pkt, Client client, bool ssl_able, bool& ssl_sent, bool& finish_startup_packet) = 0;
4040

4141
virtual ProcessResult Process(Buffer &rbuf, const size_t thread_id);
4242

src/network/connection_handle.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ Transition ConnectionHandle::FillReadBuffer() {
204204
Transition result = Transition::NEED_DATA;
205205
ssize_t bytes_read = 0;
206206
bool done = false;
207-
207+
208208
// reset buffer if all the contents have been read
209209
if (rbuf_->buf_ptr == rbuf_->buf_size) rbuf_->Reset();
210210

@@ -454,7 +454,7 @@ ProcessResult ConnectionHandle::ProcessInitial() {
454454
}
455455
// We need to handle startup packet first
456456
//TODO(Tianyi): If other protocols are added, this need to be changed
457-
bool result = protocol_handler_->ProcessInitialPacket(
457+
bool result = protocol_handler_->ProcessInitialPackets(
458458
&initial_packet_, client_, ssl_able_, ssl_handshake_,
459459
finish_startup_packet_);
460460
// Clean up the initial_packet after finishing processing.

src/network/postgres_protocol_handler.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ bool PostgresProtocolHandler::ReadPacket(Buffer &rbuf, InputPacket &rpkt) {
10531053
* process_startup_packet - Processes the startup packet
10541054
* (after the size field of the header).
10551055
*/
1056-
bool PostgresProtocolHandler::ProcessInitialPacket(InputPacket *pkt, Client client, bool ssl_able, bool& ssl_handshake, bool& finish_startup_packet) {
1056+
bool PostgresProtocolHandler::ProcessInitialPackets(InputPacket *pkt, Client client, bool ssl_able, bool& ssl_handshake, bool& finish_startup_packet) {
10571057
std::string token, value;
10581058
std::unique_ptr<OutputPacket> response(new OutputPacket);
10591059

@@ -1098,6 +1098,7 @@ bool PostgresProtocolHandler::ProcessStartupPacket(InputPacket* pkt, int32_t pro
10981098
// loop end?
10991099
if (pkt->ptr >= pkt->len) break;
11001100
GetStringToken(pkt, client.dbname);
1101+
traffic_cop_->SetDefaultDatabaseName(client.dbname);
11011102
} else if (token.compare(("user")) == 0) {
11021103
// loop end?
11031104
if (pkt->ptr >= pkt->len) break;

0 commit comments

Comments
 (0)