Separator check for network stuff.

This commit is contained in:
momo5502 2016-01-29 03:18:58 +01:00
parent c83fab449a
commit 91826963cd
2 changed files with 10 additions and 5 deletions

View File

@ -171,9 +171,14 @@ namespace Components
{
if (Network::PacketHandlers.find(Network::SelectedPacket) != Network::PacketHandlers.end())
{
std::string data;
size_t offset = Network::SelectedPacket.size() + 4 + 1;
std::string data(msg->data + offset, msg->cursize - offset);
if (static_cast<size_t>(msg->cursize) > offset)
{
data.append(msg->data + offset, msg->cursize - offset);
}
// Remove trailing 0x00 byte
if (data.size() && !data[data.size() - 1]) data.pop_back();

View File

@ -44,11 +44,11 @@ namespace Components
void Node::AddNode(Network::Address address, bool valid)
{
#ifdef DEBUG
//#ifdef DEBUG
if (address.IsSelf()) return;
#else
if (address.IsLocal() || address.IsSelf()) return;
#endif
// #else
// if (address.IsLocal() || address.IsSelf()) return;
// #endif
Node::NodeEntry entry;