Skip to content

Commit

Permalink
hopefully it now works when the connection terminates haha (f*ck)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajpro0 committed Jan 4, 2025
1 parent 8eb959d commit cecf327
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
8 changes: 5 additions & 3 deletions app/Guidzgo/FogginServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -502,20 +502,22 @@ public async Task<ReceivedPacket> ReceiveAsync(bool finishClose = true, Cancella
}
}
}
catch
catch (Exception ex)
{
try
{
recv.Release();
}
catch { }
if (ex.InnerException is SocketException)
{
FinishClose();
}
throw;
}

}



public PaketoProcessor Processor = new PaketoProcessor();

//public const int
Expand Down
13 changes: 9 additions & 4 deletions app/Guidzgo/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Net;
using System.Net.WebSockets;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Messaging;
using System.Text;
using System.Text.Json;
Expand All @@ -34,7 +35,6 @@ where x is CheckBox
(TextBox)groupBox1.Controls[c.Text.Substring(0, c.Name.Length - 1) + "T"])).ToArray();
t1 = textBox6;
t2 = textBox7;
defButtClr = button1.ForeColor;
logBoxSize = logBox.Height + 12;
LogsEnabled = false;
connLabel.Text = "";
Expand All @@ -46,7 +46,6 @@ where x is CheckBox



Color defButtClr = Color.White;
private async void button1_Click(object sender, EventArgs e)
{
try
Expand All @@ -72,7 +71,7 @@ private async void button1_Click(object sender, EventArgs e)
if (r == d)
{
// timed out
Log("A timeout was reached whils trying to send data to clients");
Log("A timeout was reached whilst trying to send data to clients");
}
else
{
Expand Down Expand Up @@ -264,6 +263,9 @@ private async void Form1_Load(object sender, EventArgs e)

foreach (var elm in toDisable)
elm.Enabled = false;

// in case it does not get put into foreground
SetForegroundWindow(Handle);
}

public SemaphoreSlim uiLock = new SemaphoreSlim(1);
Expand Down Expand Up @@ -298,6 +300,9 @@ public async Task Lock(Action a)

}

[DllImport("user32.dll")]
public static extern bool SetForegroundWindow(IntPtr hWnd);

private IEnumerable<Control> toDisable => new Control[] {
groupBox1, textBox6, label1, textBox7, label2, button1
};
Expand Down Expand Up @@ -378,7 +383,7 @@ private async Task FirstJoin(FogginClient c)
{
try
{
Log("Attempting to get labels off connected client...");
Log("Attempting to get labels off of connected client...");
using (CancellationTokenSource cts= new CancellationTokenSource())
{
cts.CancelAfter(5000);
Expand Down
1 change: 1 addition & 0 deletions app/Guidzgo/PaketoProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ async Task enter()
}
catch (Exception e)
{

if (c.serv.cts.Token.IsCancellationRequested || e is SocketClosed || e is EndOfStreamException)
{
exit();
Expand Down

0 comments on commit cecf327

Please sign in to comment.