diff --git a/server/robotserver/app.cc b/server/robotserver/app.cc index 1c098b8..b5f98e1 100755 --- a/server/robotserver/app.cc +++ b/server/robotserver/app.cc @@ -14,6 +14,7 @@ #include "app.h" #include "handlermgr.h" +#include "virtualclient.h" #include "ss_msgid.pb.h" #include "ss_proto.pb.h" diff --git a/server/robotserver/app.h b/server/robotserver/app.h index 815c1d3..af934f5 100644 --- a/server/robotserver/app.h +++ b/server/robotserver/app.h @@ -60,6 +60,8 @@ public: int instance_id = 0; bool is_test_mode = false; int test_param = 0; + std::string wsp_host; + int wsp_port = 0; std::set flags; private: diff --git a/server/robotserver/virtualclient.h b/server/robotserver/virtualclient.h index cecdc73..f030e5c 100644 --- a/server/robotserver/virtualclient.h +++ b/server/robotserver/virtualclient.h @@ -9,9 +9,9 @@ class VirtualClient { public: int instance_id = 0; + std::string account; std::string remote_ip; int remote_port = 0; - std::string account; void Init(); void UnInit(); diff --git a/server/robotserver/virtualclientmgr.cc b/server/robotserver/virtualclientmgr.cc new file mode 100644 index 0000000..f41c391 --- /dev/null +++ b/server/robotserver/virtualclientmgr.cc @@ -0,0 +1,22 @@ +#include "precompile.h" + +#include "virtualclientmgr.h" +#include "virtualclient.h" +#include "app.h" + +void VirtualClientMgr::Init() +{ + for (int i = 1; i <= App::Instance()->test_param; ++i) { + VirtualClient* client = new VirtualClient(); + client->account = a8::Format("test%d", {i}); + client->remote_ip = App::Instance()->wsp_host; + client->remote_port = App::Instance()->wsp_port; + account_hash_[client->account] = client; + client->Init(); + } +} + +void VirtualClientMgr::UnInit() +{ + +} diff --git a/server/robotserver/virtualclientmgr.h b/server/robotserver/virtualclientmgr.h new file mode 100644 index 0000000..ee7ea4d --- /dev/null +++ b/server/robotserver/virtualclientmgr.h @@ -0,0 +1,23 @@ +#pragma once + +namespace a8 +{ + class MutableXObject; +} + +class VirtualClient; +class VirtualClientMgr : public a8::Singleton +{ + + private: + VirtualClientMgr() {}; + friend class a8::Singleton; + + public: + + void Init(); + void UnInit(); + + private: + std::map account_hash_; +};