proxygen
RoutingDataHandler-inl.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017-present Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
18 namespace wangle {
19 
20 template <typename R>
22  : connId_(connId), cob_(CHECK_NOTNULL(cob)) {}
23 
24 template <typename R>
26  RoutingData routingData;
27  if (parseRoutingData(q, routingData)) {
28  cob_->onRoutingData(connId_, routingData);
29  }
30 }
31 
32 template <typename R>
34  const auto& ex = folly::make_exception_wrapper<folly::AsyncSocketException>(
36  "Received EOF before parsing routing data");
37  cob_->onError(connId_, ex);
38 }
39 
40 template <typename R>
43  cob_->onError(connId_, ex);
44 }
45 
46 } // namespace wangle
void read(Context *ctx, folly::IOBufQueue &q) override
RoutingDataHandler(uint64_t connId, Callback *cob)
virtual bool parseRoutingData(folly::IOBufQueue &bufQueue, RoutingData &routingData)=0
virtual void onError(uint64_t connId, folly::exception_wrapper ex)=0
void readException(Context *ctx, folly::exception_wrapper ex) override
void readEOF(Context *ctx) override
virtual void onRoutingData(uint64_t connId, RoutingData &routingData)=0
Handler< R, R, W, W >::Context Context
Definition: Handler.h:161