Skip to content

Commit

Permalink
fix: remove cpp retry
Browse files Browse the repository at this point in the history
  • Loading branch information
DragonAura authored May 8, 2024
1 parent eba892e commit 30b3530
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions CAPI/cpp/API/src/Communication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,18 +227,14 @@ bool Communication::Recycle(int32_t playerID, int32_t teamID)

bool Communication::TryConnection(int32_t playerID, int32_t teamID)
{
constexpr int maxRetryNum = 10;
protobuf::BoolRes reply;
ClientContext context;
auto request = THUAI72Proto::THUAI72ProtobufIDMsg(playerID, teamID);
for (int retryNum = 0; retryNum < maxRetryNum; retryNum++)
{
protobuf::BoolRes reply;
ClientContext context;
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
auto status = THUAI7Stub->TryConnection(&context, request, &reply);
if (status.ok())
return true;
}
return false;
auto status = THUAI7Stub->TryConnection(&context, request, &reply);
if (status.ok())
return true;
else
return false;
}

void Communication::AddPlayer(int32_t playerID, int32_t teamID, THUAI7::ShipType ShipType)
Expand Down

0 comments on commit 30b3530

Please sign in to comment.