TL;DR I need a way to send a file to a client that's in-game, as soon as possible, regardless of how many files I send or how many players are on the server.
This is a bit more involved than simply calling INetChannel->SendFile(). SendFile adds the file to a queue that can take time to process, which is causing issues for a plugin I am working on.
I have already looked into
FileNetMessages and
Late Downloads, but both of these use the SendFile() method.
Some background info:
I am working on a plugin that allows sprays to be resized.
It works by sending a material file to each player that uses a spray file as a base texture, precaches it, then displays it in the world.
https://forums.alliedmods.net/showthread.php?t=332418
It uses an extension called Late Downloads, which can send files to players mid-game and is capable of determining whether a player has received a file or not.
https://forums.alliedmods.net/showthread.php?t=305153
The main problem I'm having with the plugin is that with a high playercount, it takes a long time for files to be sent to each player. I took a dive into the Source engine code, and the SendFile method in the NetChannel class, rather than sending the file, calls CreateFragmentsFromFile, which adds the file to the end of a file-sending queue. My current hypothesis is that at the start of a round, this queue gets filled up with other things, which delays sending out the spray files to other players.
I would like a way for my plugin to send files as soon as the file is ready to be sent. I'm not sure if this will involve re-implementing the file sending procedure, bypassing the queue entirely, or simply adding the file to the front of the sending queue rather than the back.
The second problem I'm having is that it takes about 30 seconds after a client joins for the client to send their spray file to the server. While it's not a priority, I'd like to speed up this process as well.