As it stands, RecordBytesSent
is called twice, once under the cs_vSend
lock, and once not. This PR moves both calls out of the lock.
In doing this, I’ve made a change to SocketSendData. Before, it required the caller to lock cs_vSend
, now it locks cs_vSend
itself. The only case where this makes a difference is when performing an optimistic write (where MessageHandler is the thread that calls SocketSendData, not SocketHandler). As justified in the commit message, I don’t think this will cause any problems, and subjectively I think this is an improvement to how we’re using the locks. I’m more than happy to be told that I’m wrong :)
Additionally this PR brings PushMessage into line with the style guide, and does verious other cleanups.
This PR was originally related to #18784 but it now stands on its own.