// We set a persistent header so we don't have to include a header in every // message on the wire. If clientType changes from last used (e.g. SASL // client connects to SASL-disabled server and falls back to non-SASL), // replace the header. void HeaderChannel::updateClientType(CLIENT_TYPE ct) { if (prevClientType_ != ct) { if (ct == THRIFT_HEADER_SASL_CLIENT_TYPE) { setPersistentHeader("thrift_auth", "1"); } else if (ct == THRIFT_HEADER_CLIENT_TYPE) { setPersistentHeader("thrift_auth", "0"); } prevClientType_ = ct; } }
void MyServiceClientWrapper::setPersistentHeader(const std::string& key, const std::string& value) { auto headerChannel = async_client->getHeaderChannel(); if (headerChannel != nullptr) { headerChannel->setPersistentHeader(key, value); } }