Skip to content

Commit

Permalink
Fixed the ActiveSince timestamp so it's only set when the Area Server…
Browse files Browse the repository at this point in the history
… logs in. Previously it was always showing the current server time.

Fixed a bug i AreaServerUpdateStatus where we were not parsing out the status properly
  • Loading branch information
Zero1UP committed Sep 9, 2024
1 parent 1eb0ca5 commit d808830
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class AreaServerInformation
public Memory<byte> Detail { get; set; } = Array.Empty<byte>();
public IPEndPoint? PublicConnectionEndpoint { get; set; }
public IPEndPoint? PrivateConnectionEndpoint { get; set; }
public DateTime ActiveSince => DateTime.UtcNow;
public DateTime ActiveSince { get; set; }

public override string ToString()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public override ValueTask<ICollection<FragmentMessage>> GetResponse(FragmentTcpS
session.AreaServerInfo!.ServerName = serverNameBytes.ToShiftJisString();
session.AreaServerInfo!.Level = BinaryPrimitives.ReadUInt16BigEndian(request.Data[pos..(pos + 2)].Span);
//pos + 2 is some sort of status flag
pos += 3;
pos += 4;
session.AreaServerInfo!.State = request.Data.Span[pos++];
session.AreaServerInfo!.Detail = request.Data[pos..];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Fragment.NetSlum.Networking.Attributes;
Expand Down Expand Up @@ -30,6 +31,7 @@ public override ValueTask<ICollection<FragmentMessage>> GetResponse(FragmentTcpS
case (byte)OpCodes.DataServerKeyChange:
_logger.LogInformation("Session {SessionId} has identified itself as an Area Server", session.Id);
session.AreaServerInfo = new AreaServerInformation();
session.AreaServerInfo.ActiveSince = DateTime.UtcNow;
response = new AreaServerLogonResponse();
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Fragment.NetSlum.Networking.Constants;
using Fragment.NetSlum.Networking.Objects;
using System;
using System.Buffers.Binary;

namespace Fragment.NetSlum.Networking.Packets.Response.AreaServer;

Expand Down

0 comments on commit d808830

Please sign in to comment.