fix(core): Core cleanup, adds event loop synchronization, and fixes gumps (#429)
- [X] Cleans up gump packets
- [X] Adds event loop task synchronization
- [X] Moves timer pause and cleans up the delay task timer class
- [X] Cleans up the conserve cpu
- [X] Renames variables to make them consistent with the new style
- [X] Removes process delta recursion checking.
- [X] Properly diposes net states. This fixes edge cases that may cause hanging connections to stay open longer than they should.
- [X] Fixes an issue with gump items not compiling properly
Users can now utilize `Timer.Pause()` since the code will be executed on the proper thread.
```cs
public void async void Talk()
{
_canTalk = false;
await Timer.Pause(Utility.RandomMinMax(5000, 8000)); // Talk after 5-8 seconds
DoTalk();
await Timer.Pause(Utility.RandomMinMax(12000, 25000)); // Reset ability to talk after 12-25 seconds
_canTalk = true;
}
```
This commit is contained in:
parent
07751654b7
commit
6f0e1a22f9
24 changed files with 763 additions and 449 deletions
|
|
@ -151,20 +151,24 @@ namespace Server.Network
|
|||
}
|
||||
}
|
||||
|
||||
public static void Slice()
|
||||
public static int Slice()
|
||||
{
|
||||
int count = 0;
|
||||
var limit = m_ConnectedQueue.Count;
|
||||
|
||||
while (count++ < 250)
|
||||
while (m_ConnectedQueue.Count > 0 && --limit >= 0)
|
||||
{
|
||||
if (!m_ConnectedQueue.TryDequeue(out var ns))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
count++;
|
||||
Instances.Add(ns);
|
||||
ns.WriteConsole("Connected. [{0} Online]", Instances.Count);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
private static async void BeginAcceptingSockets(this TcpListener listener)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue