Skip to content

Commit

Permalink
quic: use ToString in prep for FPrintF
Browse files Browse the repository at this point in the history
PR-URL: nodejs#294
Reviewed-By: Anna Henningsen <[email protected]>
  • Loading branch information
jasnell committed Feb 3, 2020
1 parent 0a974c0 commit a088a97
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/quic/node_quic_socket-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,21 @@ void QuicSocket::AssociateCID(

void QuicSocket::DisassociateCID(const QuicCID& cid) {
if (cid) {
Debug(this, "Removing association for cid %s", cid.ToHex().c_str());
Debug(this, "Removing association for cid %s", cid.ToString().c_str());
dcid_to_scid_.erase(cid);
}
}

void QuicSocket::AssociateStatelessResetToken(
const StatelessResetToken& token,
BaseObjectPtr<QuicSession> session) {
Debug(this, "Associating stateless reset token %s", token.ToHex().c_str());
Debug(this, "Associating stateless reset token %s", token.ToString().c_str());
token_map_[token] = session;
}

void QuicSocket::DisassociateStatelessResetToken(
const StatelessResetToken& token) {
Debug(this, "Removing stateless reset token %s", token.ToHex().c_str());
Debug(this, "Removing stateless reset token %s", token.ToString().c_str());
token_map_.erase(token);
}

Expand Down
2 changes: 1 addition & 1 deletion src/quic/node_quic_socket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ void QuicSocket::OnReceive(
// allow us to pass the QuicCID directly to Debug and have it
// converted to hex only if the category is enabled so we can
// skip committing resources here.
std::string dcid_hex = dcid.ToHex();
std::string dcid_hex = dcid.ToString();
Debug(this, "Received a QUIC packet for dcid %s", dcid_hex.c_str());

BaseObjectPtr<QuicSession> session = FindSession(dcid);
Expand Down
4 changes: 2 additions & 2 deletions src/quic/node_quic_util-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ bool QuicCID::Compare::operator()(
false : memcmp(lcid->data, rcid->data, lcid->datalen) == 0;
}

std::string QuicCID::ToHex() const {
std::string QuicCID::ToString() const {
std::vector<char> dest(ptr_->datalen * 2 + 1);
dest[dest.size() - 1] = '\0';
size_t written = StringBytes::hex_encode(
Expand Down Expand Up @@ -288,7 +288,7 @@ StatelessResetToken::StatelessResetToken(
GenerateResetToken(buf_, secret, cid);
}

std::string StatelessResetToken::ToHex() const {
std::string StatelessResetToken::ToString() const {
std::vector<char> dest(NGTCP2_STATELESS_RESET_TOKENLEN * 2 + 1);
dest[dest.size() - 1] = '\0';
size_t written = StringBytes::hex_encode(
Expand Down
4 changes: 2 additions & 2 deletions src/quic/node_quic_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class QuicCID : public MemoryRetainer {
inline bool operator()(const QuicCID& lcid, const QuicCID& rcid) const;
};

inline std::string ToHex() const;
inline std::string ToString() const;

// Copy assignment
QuicCID& operator=(const QuicCID& cid) {
Expand Down Expand Up @@ -307,7 +307,7 @@ class StatelessResetToken : public MemoryRetainer {
const uint8_t* token)
: token_(token) {}

inline std::string ToHex() const;
inline std::string ToString() const;
const uint8_t* data() const { return token_; }

struct Hash {
Expand Down

0 comments on commit a088a97

Please sign in to comment.