Check for empty string to prevent setting an empty value on the custom
parameters map. Also fix a typo on formatting which was using the
standard parameters as custom parameters.
PRUDPLite and PRUDPv1 were missing some size checks while parsing their
data. We also need one bounds check at the beginning to choose the
proper packet type by the magic.
This got lost in the types refactor, and was a rare case of the pointer receiver actually being needed - various apps depended on this function modifying the underlying value.
One could also argue for this being factored out into a NewDateTimeFromTimestamp function or something, but this way is source-compatible with older code.
An expected invariant of this system is that StateConnected connections also have a PID, and other states do *not* have a PID.
While any code that breaks this invariant is buggy, we can still make FindConnectionByPID resilient to this to prevent that type of bug from taking the whole server down.
That type of bug can still be detected through explicit testing of the Connections map.
Centralising connection closures helps ensure that everything gets done (.cleanup()) and there's One True Way to find them in the Connections map
It's worth noting that every callsite has a PRUDPConnection*, so maybe a different datastructure would serve us better here?
Every SocketConnection had a map of *PRUDPConnection, which was never actually inserted into anywhere, so the intended function of tracking what OS sockets have which PRUDP streams was not being done.
Remove it as dead code. If the rest of the connection tracking is going to be implemented, this commit can be reverted.
Since the SocketConnection no longer has long-lived state in it, also remove the map on PRUDPServer and just create it as a simple data structure when needed.
The connection close handling of the websocket server had to be rewritten - the old code would never do anything due to the empty maps, so this can't be *worse* than nothing :)