MCPcopy Create free account
hub / github.com/apache/impala / getTransport

Method getTransport

be/src/transport/TSaslServerTransport.cpp:112–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112std::shared_ptr<TTransport> TSaslServerTransport::Factory::getTransport(
113 std::shared_ptr<TTransport> trans) {
114 // Thrift servers use both an input and an output transport to communicate with
115 // clients. In principal, these can be different, but for SASL clients we require them
116 // to be the same so that the authentication state is identical for communication in
117 // both directions. In order to do this, we share the same TTransport object for both
118 // input and output set in TAcceptQueueServer::SetupConnection.
119 std::shared_ptr<impala::ThriftServer::BufferedTransport> ret_transport;
120 std::shared_ptr<TTransport> wrapped(
121 new TSaslServerTransport(serverDefinitionMap_, trans));
122 // Verify the max message size is inherited properly
123 impala::VerifyMaxMessageSizeInheritance(trans.get(), wrapped.get());
124 // Set socket timeouts to prevent TSaslServerTransport->open from blocking the server
125 // from accepting new connections if a read/write blocks during the handshake
126 TSocket* socket = static_cast<TSocket*>(trans.get());
127 socket->setRecvTimeout(FLAGS_sasl_connect_tcp_timeout_ms);
128 socket->setSendTimeout(FLAGS_sasl_connect_tcp_timeout_ms);
129 ret_transport.reset(new impala::ThriftServer::BufferedTransport(wrapped,
130 impala::ThriftServer::BufferedTransportFactory::DEFAULT_BUFFER_SIZE_BYTES,
131 wrapped->getConfiguration()));
132 impala::VerifyMaxMessageSizeInheritance(wrapped.get(), ret_transport.get());
133 ret_transport.get()->open();
134 // Reset socket timeout back to zero, so idle clients do not timeout
135 socket->setRecvTimeout(0);
136 socket->setSendTimeout(0);
137 return ret_transport;
138}
139
140}}}
141#endif

Callers 1

handleMethod · 0.45

Calls 7

setRecvTimeoutMethod · 0.80
setSendTimeoutMethod · 0.80
getMethod · 0.65
resetMethod · 0.65
openMethod · 0.65
getConfigurationMethod · 0.45

Tested by 1

handleMethod · 0.36