mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 19:00:14 -05:00
network: Use lower timeout for enet_host_service
This allows us to have a 10x higher throughput of packets by using a much shorter waiting time.
This commit is contained in:
parent
d92826963a
commit
b961b385c3
2 changed files with 2 additions and 2 deletions
|
@ -234,7 +234,7 @@ public:
|
||||||
void Room::RoomImpl::ServerLoop() {
|
void Room::RoomImpl::ServerLoop() {
|
||||||
while (state != State::Closed) {
|
while (state != State::Closed) {
|
||||||
ENetEvent event;
|
ENetEvent event;
|
||||||
if (enet_host_service(server, &event, 50) > 0) {
|
if (enet_host_service(server, &event, 5) > 0) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case ENET_EVENT_TYPE_RECEIVE:
|
case ENET_EVENT_TYPE_RECEIVE:
|
||||||
switch (event.packet->data[0]) {
|
switch (event.packet->data[0]) {
|
||||||
|
|
|
@ -159,7 +159,7 @@ void RoomMember::RoomMemberImpl::MemberLoop() {
|
||||||
while (IsConnected()) {
|
while (IsConnected()) {
|
||||||
std::lock_guard lock(network_mutex);
|
std::lock_guard lock(network_mutex);
|
||||||
ENetEvent event;
|
ENetEvent event;
|
||||||
if (enet_host_service(client, &event, 100) > 0) {
|
if (enet_host_service(client, &event, 5) > 0) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case ENET_EVENT_TYPE_RECEIVE:
|
case ENET_EVENT_TYPE_RECEIVE:
|
||||||
switch (event.packet->data[0]) {
|
switch (event.packet->data[0]) {
|
||||||
|
|
Loading…
Reference in a new issue