diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp
index 7ef7594..3ecb493 100644
--- a/rehlds/engine/sv_main.cpp
+++ b/rehlds/engine/sv_main.cpp
@@ -4619,6 +4619,12 @@ void SV_UpdateToReliableMessages(void)
SZ_Clear(&g_psv.spectator);
}
+ //Fix for the "server failed to transmit file 'AY&SY..." bug
+ //https://github.com/dreamstalker/rehlds/issues/38
+#ifdef REHLDS_FIXES
+ bool svReliableCompressed = false;
+#endif
+
// Send broadcast data
for (i = 0; i < g_psvs.maxclients; i++)
{
@@ -4626,6 +4632,19 @@ void SV_UpdateToReliableMessages(void)
if (!client->fakeclient && client->active)
{
+ //Fix for the "server failed to transmit file 'AY&SY..." bug
+ //https://github.com/dreamstalker/rehlds/issues/38
+#ifdef REHLDS_FIXES
+ if (!svReliableCompressed && g_psv.reliable_datagram.cursize + client->netchan.message.cursize < client->netchan.message.maxsize)
+ {
+ SZ_Write(&client->netchan.message, g_psv.reliable_datagram.data, g_psv.reliable_datagram.cursize);
+ }
+ else
+ {
+ Netchan_CreateFragments(TRUE, &client->netchan, &g_psv.reliable_datagram);
+ svReliableCompressed = true;
+ }
+#else
if (g_psv.reliable_datagram.cursize + client->netchan.message.cursize < client->netchan.message.maxsize)
{
SZ_Write(&client->netchan.message, g_psv.reliable_datagram.data, g_psv.reliable_datagram.cursize);
@@ -4634,6 +4653,7 @@ void SV_UpdateToReliableMessages(void)
{
Netchan_CreateFragments(TRUE, &client->netchan, &g_psv.reliable_datagram);
}
+#endif
if (g_psv.datagram.cursize + client->datagram.cursize < client->datagram.maxsize)
{
diff --git a/rehlds/msvc/ReHLDS.vcxproj b/rehlds/msvc/ReHLDS.vcxproj
index 3fa0431..ff70563 100644
--- a/rehlds/msvc/ReHLDS.vcxproj
+++ b/rehlds/msvc/ReHLDS.vcxproj
@@ -1055,7 +1055,7 @@
true
true
true
- REHLDS_FLIGHT_REC;REHLDS_OPT_PEDANTIC;REHLDS_SELF;REHLDS_CHECKS;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
+ REHLDS_FIXES;REHLDS_FLIGHT_REC;REHLDS_OPT_PEDANTIC;REHLDS_SELF;REHLDS_CHECKS;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
MultiThreaded
/arch:IA32 %(AdditionalOptions)
Use