Changeset View
Changeset View
Standalone View
Standalone View
source/lib/external_libraries/enet.cpp
- This file was added.
/* Copyright (C) 2023 Wildfire Games. | |||||
* This file is part of 0 A.D. | |||||
* | |||||
* 0 A.D. is free software: you can redistribute it and/or modify | |||||
* it under the terms of the GNU General Public License as published by | |||||
* the Free Software Foundation, either version 2 of the License, or | |||||
* (at your option) any later version. | |||||
* | |||||
* 0 A.D. is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU General Public License | |||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
#include "enet.h" | |||||
#include "ps/containers/Span.h" | |||||
ENetHost* ps_enet_host_create_with_mtu(const ENetAddress * address, size_t | |||||
peerCount, size_t channelLimit, enet_uint32 incomingBandwidth, | |||||
enet_uint32 outgoingBandwidth, enet_uint32 mtu) | |||||
{ | |||||
ENetHost* host = enet_host_create(address, peerCount, channelLimit, | |||||
incomingBandwidth, outgoingBandwidth); | |||||
if (!host) | |||||
return nullptr; | |||||
// public enet api doesnt' offer a means to change mtu, so do it in a | |||||
// way least likely to break with enet updates | |||||
// TODO: check for additions to enet public api | |||||
host->mtu = mtu; | |||||
for (ENetPeer& p : PS::span{host->peers, host->peerCount}) | |||||
enet_peer_reset(&p); | |||||
return host; | |||||
} |
Wildfire Games · Phabricator