Skip to content

Commit 8c88a26

Browse files
committed
Example adjusted to make it work again.
Open TcpConnection (none-async) won't cause a deadlock anymore. Packets (without RequestPacket as inheritance) are receivable. Version increment.
1 parent 9bf9820 commit 8c88a26

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

Examples/TestServerClientPackets/ExamplePacketsOne/AddStudentToDatabaseResponse.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ namespace TestServerClientPackets.ExamplePacketsOne
77
[PacketRequest(typeof(AddStudentToDatabaseRequest))]
88
public class AddStudentToDatabaseResponse : ResponsePacket
99
{
10-
public AddStudentToDatabaseResponse(DatabaseResult? result,
10+
public AddStudentToDatabaseResponse(DatabaseResult result,
1111
AddStudentToDatabaseRequest addStudentRequest)
1212
: base(addStudentRequest)
1313
{
1414
Result = result;
1515
}
1616

17-
public DatabaseResult? Result { get; set; }
17+
public DatabaseResult Result { get; set; }
1818
}
1919
}

Network/.vs/Network/v15/.suo

0 Bytes
Binary file not shown.

Network/Connection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ private void HandleDefaultPackets(Packet packet)
751751
{
752752
if (packet.GetType().IsSubclassOf(typeof(ResponsePacket)) && objectMap[packet.ID] != null)
753753
objectMap[packet.ID].DynamicInvoke(new object[] { packet, this });
754-
else if (packet.GetType().IsSubclassOf(typeof(RequestPacket)) && objectMap[packet.GetType()] != null)
754+
else if (objectMap[packet.GetType()] != null)
755755
objectMap[packet.GetType()].DynamicInvoke(new object[] { packet, this });
756756
else PacketWithoutHandlerReceived(packet);
757757
}

Network/ConnectionFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public static async Task<Tuple<TcpConnection, ConnectionResult>> CreateTcpConnec
208208
TcpClient tcpClient = new TcpClient();
209209
Task timeoutTask = Task.Delay(CONNECTION_TIMEOUT);
210210
Task connectTask = Task.Factory.StartNew(() => tcpClient.Connect(ipAddress, port));
211-
if (await Task.WhenAny(timeoutTask, connectTask) != timeoutTask && tcpClient.Connected)
211+
if (await Task.WhenAny(timeoutTask, connectTask).ConfigureAwait(false) != timeoutTask && tcpClient.Connected)
212212
return new Tuple<TcpConnection, ConnectionResult>(new TcpConnection(tcpClient), ConnectionResult.Connected);
213213

214214
return new Tuple<TcpConnection, ConnectionResult>(null, ConnectionResult.Timeout);

Network/Network.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
77
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
88
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
9-
<Version>6.1.0.6</Version>
9+
<Version>6.1.0.7</Version>
1010
<Authors>Thomas Christof</Authors>
1111
<Company>Indie-Dev</Company>
1212
<Description>Network library supporting: TCP, UDP, Bluetooth, RSA, events and objects. Fast and simple, with only 48bit overhead per packet. Send and receive packets with async operations.
@@ -29,8 +29,8 @@ Release preview dependencies removed.
2929
None integer inheritance enums are serializable.
3030
ConnectionFactory (async) Bugfixes.</PackageReleaseNotes>
3131
<NeutralLanguage>en-US</NeutralLanguage>
32-
<AssemblyVersion>6.1.0.6</AssemblyVersion>
33-
<FileVersion>6.1.0.6</FileVersion>
32+
<AssemblyVersion>6.1.0.7</AssemblyVersion>
33+
<FileVersion>6.1.0.7</FileVersion>
3434
</PropertyGroup>
3535
<ItemGroup>
3636
<Compile Remove="packages\**" />

0 commit comments

Comments
 (0)