Created
June 20, 2017 15:28
-
-
Save squaregear/80821130d221727c3836dba3224bf93e to your computer and use it in GitHub Desktop.
Demonstrates crash from AsterNet thread
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using AsterNET.Manager; | |
using AsterNET.Util; | |
namespace AsterNetTest | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Dialer d = new Dialer(); | |
Thread.Sleep(30 * 60 * 1000); | |
} | |
} | |
class Dialer : ThreadClass | |
{ | |
public ManagerConnection Manager { get; set; } | |
public Dialer() | |
{ | |
Console.WriteLine($"{DateTime.Now} Connecting"); | |
Manager = new ManagerConnection("myhost", 5038, "myuser", "mypassword"); | |
Manager.PingInterval = 0; | |
Manager.Login(); | |
IsBackground = true; | |
Start(); | |
} | |
public override void Run() | |
{ | |
while (true) | |
{ | |
if (!Manager.IsConnected()) | |
{ | |
Console.WriteLine($"{DateTime.Now} Reconnecting"); | |
Manager.Logoff(); | |
Manager = new ManagerConnection("myhost", 5038, "myuser", "mypassword"); | |
Manager.PingInterval = 0; | |
Manager.Login(); | |
} | |
Thread.Sleep(15 * 1000); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment