| 202 | } |
| 203 | |
| 204 | void* ThriftServer::ThriftServerEventProcessor::createContext( |
| 205 | std::shared_ptr<TProtocol> input, std::shared_ptr<TProtocol> output) { |
| 206 | std::shared_ptr<ConnectionContext> connection_ptr = |
| 207 | std::shared_ptr<ConnectionContext>(new ConnectionContext); |
| 208 | thrift_server_->auth_provider_->SetupConnectionContext(connection_ptr, |
| 209 | thrift_server_->transport_type_, input->getTransport().get(), |
| 210 | output->getTransport().get()); |
| 211 | |
| 212 | { |
| 213 | connection_ptr->server_name = thrift_server_->name_; |
| 214 | |
| 215 | lock_guard<mutex> l(thrift_server_->connection_contexts_lock_); |
| 216 | uuid connection_uuid = thrift_server_->uuid_generator_(); |
| 217 | UUIDToTUniqueId(connection_uuid, &connection_ptr->connection_id); |
| 218 | |
| 219 | // Add the connection to the connection map. |
| 220 | __connection_context__ = connection_ptr.get(); |
| 221 | thrift_server_->connection_contexts_[connection_ptr.get()] = connection_ptr; |
| 222 | } |
| 223 | |
| 224 | if (thrift_server_->connection_handler_ != NULL) { |
| 225 | thrift_server_->connection_handler_->ConnectionStart(*__connection_context__); |
| 226 | } |
| 227 | |
| 228 | if (thrift_server_->metrics_enabled_) { |
| 229 | thrift_server_->num_current_connections_metric_->Increment(1L); |
| 230 | thrift_server_->total_connections_metric_->Increment(1L); |
| 231 | } |
| 232 | |
| 233 | // Store the __connection_context__ in the per-client context. If only this were |
| 234 | // accessible from RPC method calls, we wouldn't have to |
| 235 | // mess around with thread locals. |
| 236 | return (void*)__connection_context__; |
| 237 | } |
| 238 | |
| 239 | void ThriftServer::ThriftServerEventProcessor::processContext(void* context, |
| 240 | std::shared_ptr<TTransport> transport) { |
no test coverage detected