Core/Battlegrounds: Move to scripts And a lot of misc commits i couldn't recover.

Port From (https://github.com/TrinityCore/TrinityCore/commit/d0d5d309bb5877dc2fcb27f6cb123707a31ec1e8)
This commit is contained in:
Hondacrx
2024-08-04 15:18:22 -04:00
parent bca02a24b0
commit e9b21a91be
139 changed files with 8322 additions and 8700 deletions
@@ -6,6 +6,7 @@ using Framework.Database;
using Framework.Web;
using System;
using System.Net.Sockets;
using System.Threading.Tasks;
namespace Framework.Networking.Http
{
@@ -20,9 +21,21 @@ namespace Framework.Networking.Http
public Guid? GetSessionId();
}
public abstract class BaseSocket<Derived> : SSLSocket, IAbstractSocket
public abstract class BaseHttpSocket : SocketBase, IAbstractSocket
{
public BaseSocket(Socket socket) : base(socket) { }
public BaseHttpSocket(Socket socket, bool useSSL = false) : base(socket, useSSL) { }
public async override Task HandshakeHandler(Exception exception = null)
{
if (exception != null)
{
Log.outError(LogFilter.Http, $"{GetClientInfo()} SSL Handshake failed {exception.Message}");
CloseSocket();
return;
}
await AsyncRead();
}
public async override void ReadHandler(byte[] data, int receivedLength)
{
@@ -114,5 +127,6 @@ namespace Framework.Networking.Http
protected AsyncCallbackProcessor<QueryCallback> _queryProcessor = new();
protected SessionState _state;
protected ISocket socket;
}
}
@@ -1,39 +0,0 @@
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading.Tasks;
using System.Security.Cryptography.X509Certificates;
using Framework.Configuration;
namespace Framework.Networking.Http
{
public class SslSocket<Derived> : BaseSocket<Derived>
{
X509Certificate2 _certificate;
public SslSocket(Socket socket) : base(socket)
{
_certificate = new X509Certificate2(ConfigMgr.GetDefaultValue("CertificatesFile", "./BNetServer.pfx"));
}
public async override void Start()
{
await AsyncHandshake(_certificate);
}
public async override Task HandshakeHandler(Exception exception = null)
{
if (exception != null)
{
Log.outError(LogFilter.Http, $"{GetClientInfo()} SSL Handshake failed {exception.Message}");
CloseSocket();
return;
}
await AsyncRead();
}
}
}