blob: 05d504b5ebdc16dace190751b78de8df3ff2b2db [file] [log] [blame]
David Reiss5ddabb82010-10-06 17:09:37 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#include "TAsyncProtocolProcessor.h"
21
22using apache::thrift::transport::TBufferBase;
23using apache::thrift::protocol::TProtocol;
24
25namespace apache { namespace thrift { namespace async {
26
27void TAsyncProtocolProcessor::process(
28 std::tr1::function<void(bool healthy)> _return,
29 boost::shared_ptr<TBufferBase> ibuf,
30 boost::shared_ptr<TBufferBase> obuf) {
31 boost::shared_ptr<TProtocol> iprot(pfact_->getProtocol(ibuf));
32 boost::shared_ptr<TProtocol> oprot(pfact_->getProtocol(obuf));
33 return underlying_->process(
34 std::tr1::bind(
35 &TAsyncProtocolProcessor::finish,
36 _return,
37 oprot,
38 std::tr1::placeholders::_1),
39 iprot, oprot);
40}
41
42/* static */ void TAsyncProtocolProcessor::finish(
43 std::tr1::function<void(bool healthy)> _return,
44 boost::shared_ptr<TProtocol> oprot,
45 bool healthy) {
46 // This is a stub function to hold a reference to oprot.
47 return _return(healthy);
48}
49
50}}} // apache::thrift::async