Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Receive()

int Terraria.Social.Steam.SteamP2PReader.Receive ( CSteamID user,
byte[] buffer,
int bufferOffset,
int bufferSize )
inline

Definition at line 131 of file SteamP2PReader.cs.

132 {
133 //IL_0019: Unknown result type (might be due to invalid IL or missing references)
134 //IL_002f: Unknown result type (might be due to invalid IL or missing references)
135 uint num = 0u;
137 {
139 {
140 return 0;
141 }
143 while (queue.Count > 0)
144 {
145 ReadResult readResult = queue.Peek();
146 uint num2 = Math.Min((uint)bufferSize - num, readResult.Size - readResult.Offset);
147 if (num2 == 0)
148 {
149 return (int)num;
150 }
151 Array.Copy(readResult.Data, readResult.Offset, buffer, bufferOffset + num, num2);
152 if (num2 == readResult.Size - readResult.Offset)
153 {
154 _bufferPool.Enqueue(queue.Dequeue().Data);
155 }
156 else
157 {
158 readResult.Offset += num2;
159 }
160 num += num2;
161 }
162 return (int)num;
163 }
164 }
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
Definition Array.cs:624
static byte Min(byte val1, byte val2)
Definition Math.cs:912
Dictionary< CSteamID, Queue< ReadResult > > _pendingReadBuffers

References Terraria.Social.Steam.SteamP2PReader._bufferPool, Terraria.Social.Steam.SteamP2PReader._pendingReadBuffers, System.buffer, System.Collections.Generic.Dictionary< TKey, TValue >.ContainsKey(), System.Array.Copy(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Collections.Generic.Queue< T >.Enqueue(), and System.Math.Min().

Referenced by Terraria.Social.Steam.NetSocialModule.Receive().