Fixing some ASN.1 related bugs. Playing a game works now, but there is still an issue when the lobby is started after the game.
This commit is contained in:
@@ -830,7 +830,6 @@ AbstractClientStateReceiving::HandlePacket(boost::shared_ptr<ClientThread> clien
|
||||
client->RequestPlayerInfo(playerId);
|
||||
}
|
||||
tmpInfo.players.push_back(playerId);
|
||||
++i;
|
||||
}
|
||||
tmpInfo.adminPlayerId = netListNew->adminPlayerId;
|
||||
tmpInfo.isPasswordProtected = netListNew->isPrivate ? true : false;
|
||||
@@ -941,8 +940,8 @@ AbstractClientStateReceiving::HandlePacket(boost::shared_ptr<ClientThread> clien
|
||||
// Show the error.
|
||||
throw ClientException(__FILE__, __LINE__, NetPacket::NetErrorToGameError(netError->errorReason), 0);
|
||||
}
|
||||
else
|
||||
InternalHandlePacket(client, tmpPacket);
|
||||
|
||||
InternalHandlePacket(client, tmpPacket);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -1302,8 +1301,6 @@ ClientStateWaitStart::InternalHandlePacket(boost::shared_ptr<ClientThread> clien
|
||||
if (!tmpPlayer.get())
|
||||
throw ClientException(__FILE__, __LINE__, ERR_NET_UNKNOWN_PLAYER_ID, 0);
|
||||
tmpPlayer->SetNumber(i);
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1602,7 +1599,6 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
|
||||
tmpCards[0] = static_cast<int>(p->allInCard1);
|
||||
tmpCards[1] = static_cast<int>(p->allInCard2);
|
||||
tmpPlayer->setMyCards(tmpCards);
|
||||
++i;
|
||||
}
|
||||
client->GetGui().flipHolecardsAllIn();
|
||||
}
|
||||
|
||||
@@ -87,6 +87,22 @@ NetPacket::IsClientActivity() const
|
||||
return retVal;
|
||||
}
|
||||
|
||||
static int
|
||||
net_packet_print_to_string(const void *buffer, size_t size, void *packetStr)
|
||||
{
|
||||
string *tmpString = (string *)packetStr;
|
||||
*tmpString += string((const char *)buffer, size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
string
|
||||
NetPacket::ToString() const
|
||||
{
|
||||
string packetString;
|
||||
xer_encode(&asn_DEF_PokerTHMessage, m_msg, XER_F_BASIC, &net_packet_print_to_string, &packetString);
|
||||
return packetString;
|
||||
}
|
||||
|
||||
void
|
||||
NetPacket::SetGameData(const GameData &inData, NetGameInfo_t *outData)
|
||||
{
|
||||
|
||||
@@ -61,8 +61,11 @@ ReceiverHelper::ScanPackets(ReceiveBuffer &buf)
|
||||
LOG_ERROR(e.what());
|
||||
}
|
||||
}
|
||||
if (tmpPacket.get())
|
||||
if (tmpPacket)
|
||||
{
|
||||
//cerr << "IN:" << endl << tmpPacket->ToString() << endl;
|
||||
buf.receivedPackets.push_back(tmpPacket);
|
||||
}
|
||||
else
|
||||
dataAvailable = false;
|
||||
} while(dataAvailable);
|
||||
|
||||
@@ -236,6 +236,7 @@ SenderHelper::InternalStorePacket(SendDataManager &tmpManager, boost::shared_ptr
|
||||
unsigned char buf[MAX_PACKET_SIZE];
|
||||
asn_enc_rval_t e;
|
||||
e = der_encode_to_buffer(&asn_DEF_PokerTHMessage, packet->GetMsg(), buf, MAX_PACKET_SIZE);
|
||||
//cerr << "OUT:" << endl << packet->ToString() << endl;
|
||||
if (e.encoded == -1)
|
||||
LOG_ERROR("Failed to encode NetPacket: " << packet->GetMsg()->present);
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user