mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-11-23 20:38:07 +01:00
Cleanup.
This commit is contained in:
parent
cf05e58266
commit
8daa896c86
1 changed files with 5 additions and 4 deletions
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
struct Steam_Networking_Connection {
|
struct Steam_Networking_Connection {
|
||||||
CSteamID remote;
|
CSteamID remote;
|
||||||
std::vector<int> open_channels;
|
std::set<int> open_channels;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct steam_listen_socket {
|
struct steam_listen_socket {
|
||||||
|
@ -257,7 +257,7 @@ bool SendP2PPacket( CSteamID steamIDRemote, const void *pubData, uint32 cubData,
|
||||||
msg.mutable_network()->set_type(Network::DATA);
|
msg.mutable_network()->set_type(Network::DATA);
|
||||||
|
|
||||||
struct Steam_Networking_Connection *conn = get_or_create_connection(steamIDRemote);
|
struct Steam_Networking_Connection *conn = get_or_create_connection(steamIDRemote);
|
||||||
PUSH_BACK_IF_NOT_IN(conn->open_channels, nChannel);
|
conn->open_channels.insert(nChannel);
|
||||||
bool ret = network->sendTo(&msg, reliable);
|
bool ret = network->sendTo(&msg, reliable);
|
||||||
PRINT_DEBUG("Sent message with size: %zu %u\n", msg.network().data().size(), ret);
|
PRINT_DEBUG("Sent message with size: %zu %u\n", msg.network().data().size(), ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -388,7 +388,8 @@ bool CloseP2PChannelWithUser( CSteamID steamIDRemote, int nChannel )
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Steam_Networking_Connection *conn = get_or_create_connection(steamIDRemote);
|
struct Steam_Networking_Connection *conn = get_or_create_connection(steamIDRemote);
|
||||||
conn->open_channels.erase(std::remove(conn->open_channels.begin(), conn->open_channels.end(), nChannel), conn->open_channels.end());
|
|
||||||
|
conn->open_channels.erase(nChannel);
|
||||||
if (conn->open_channels.size() == 0) {
|
if (conn->open_channels.size() == 0) {
|
||||||
remove_connection(steamIDRemote);
|
remove_connection(steamIDRemote);
|
||||||
}
|
}
|
||||||
|
@ -750,7 +751,7 @@ void RunCallbacks()
|
||||||
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data), true);
|
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data), true);
|
||||||
} else {
|
} else {
|
||||||
struct Steam_Networking_Connection *conn = get_or_create_connection(source_id);
|
struct Steam_Networking_Connection *conn = get_or_create_connection(source_id);
|
||||||
PUSH_BACK_IF_NOT_IN(conn->open_channels, msg.network().channel());
|
conn->open_channels.insert(msg.network().channel());
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.mutable_network()->set_processed(true);
|
msg.mutable_network()->set_processed(true);
|
||||||
|
|
Loading…
Reference in a new issue