tanghai 14 лет назад
Родитель
Сommit
590cc4f39c

+ 7 - 3
Src/Egametang/Rpc/RpcChannel.cc

@@ -1,12 +1,16 @@
 #include <boost/asio.hpp>
-#include <boost/make_shared.hpp>
+#include <boost/bind.hpp>
+#include <glog/logging.h>
 #include <google/protobuf/message.h>
+#include "Rpc/RpcCommunicator.h"
 #include "Rpc/RpcChannel.h"
+#include "Rpc/RpcHandler.h"
+#include "Rpc/RpcProtobufData.pb.h"
 
 namespace Egametang {
 
 RpcChannel::RpcChannel(boost::asio::io_service& io_service, std::string host, int port):
-		io_service_(io_service)
+		RpcCommunicator(io_service)
 {
 	// another thread?
 	boost::asio::ip::address address;
@@ -70,7 +74,7 @@ void RpcChannel::CallMethod(
 	RpcHandlerPtr handler(new RpcHandler(controller, response, done));
 	handlers_[id_] = handler;
 
-	SendRequest(request);
+	SendRequest(req);
 }
 
 } // namespace Egametang

+ 0 - 1
Src/Egametang/Rpc/RpcChannel.h

@@ -21,7 +21,6 @@ private:
 
 	int32 id_;
 	RpcCallbackMap handlers_;
-	boost::asio::io_service& io_service_;
 
 	void OnAsyncConnect(const boost::system::error_code& err);
 	void SendRequest(RpcRequestPtr request);

+ 2 - 0
Src/Egametang/Rpc/RpcChannelTest.cc

@@ -2,6 +2,8 @@
 #include <gflags/gflags.h>
 #include <glog/logging.h>
 #include "Rpc/RpcChannel.h"
+#include "Rpc/RpcProtobufData.pb.h"
+#include "Rpc/RpcChannelTest.pb.h"
 
 namespace Egametang {
 

+ 6 - 7
Src/Egametang/Rpc/RpcHandler.h

@@ -1,11 +1,10 @@
-#ifndef RPC_RPC_HANDLER_H
-#define RPC_RPC_HANDLER_H
+#ifndef RPC_RPCHANDLER_H
+#define RPC_RPCHANDLER_H
 
-namespace Egametang {
+#include <google/protobuf/service.h>
+#include <google/protobuf/message.h>
 
-class google::protobuf::RpcController;
-class google::protobuf::Message;
-class google::protobuf::Closure;
+namespace Egametang {
 
 class RpcHandler
 {
@@ -24,4 +23,4 @@ public:
 
 } // namespace Egametang
 
-#endif // RPC_RPC_HANDLER_H
+#endif // RPC_RPCHANDLER_H