2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-06-27 05:23:13 +00:00
This commit is contained in:
2021-05-26 08:55:42 +03:00
parent 82cbe3b01c
commit ece7c7d08f
10 changed files with 36 additions and 26 deletions

View File

@ -869,6 +869,15 @@ namespace Esiur.Net.IIP
//Global.Log("auth", LogType.Warning, "U:" + RemoteUsername + " IP:" + Socket.RemoteEndPoint.Address.ToString() + " S:AUTH");
}
else
{
SendParams()
.AddUInt8(0xc0)
.AddUInt8((byte)ExceptionCode.GeneralFailure)
.AddUInt16(9)
.AddString("Not ready")
.Done();
}
}
}
}
@ -876,15 +885,16 @@ namespace Esiur.Net.IIP
{
if (authPacket.Command == IIPAuthPacket.IIPAuthPacketCommand.Acknowledge)
{
if (authPacket.LocalMethod == AuthenticationMethod.None)
if (authPacket.RemoteMethod == AuthenticationMethod.None)
{
// send establish
SendParams()
.AddUInt8(0x20)
.AddUInt16(0)
.Done();
}
else if (authPacket.LocalMethod == AuthenticationMethod.Credentials
|| authPacket.LocalMethod == AuthenticationMethod.Token)
else if (authPacket.RemoteMethod == AuthenticationMethod.Credentials
|| authPacket.RemoteMethod == AuthenticationMethod.Token)
{
remoteNonce = authPacket.RemoteNonce;

View File

@ -1098,7 +1098,7 @@ namespace Esiur.Net.IIP
var templates = new List<ResourceTemplate>();
foreach (var resource in list)
templates.AddRange(ResourceTemplate.GetRuntimeTypes(resource.Instance.Template).Where(x => !templates.Contains(x)));
templates.AddRange(ResourceTemplate.GetDependencies(resource.Instance.Template).Where(x => !templates.Contains(x)));
foreach(var t in templates)
{
@ -2210,8 +2210,8 @@ namespace Esiur.Net.IIP
if (resource == null)
{
var template = Warehouse.GetTemplate((Guid)rt[0]);
if (template?.RuntimeType != null)
dr = Activator.CreateInstance(template.RuntimeType, this, id, (ulong)rt[1], (string)rt[2]) as DistributedResource;
if (template?.ResourceType != null)
dr = Activator.CreateInstance(template.ResourceType, this, id, (ulong)rt[1], (string)rt[2]) as DistributedResource;
else
dr = new DistributedResource(this, id, (ulong)rt[1], (string)rt[2]);
}

View File

@ -146,7 +146,7 @@ namespace Esiur.Net.Packets
//Console.WriteLine("stage 2 " + needed);
return length - needed;
}
PayloadLength = DC.GetUInt16(data, offset);
PayloadLength = data.GetUInt16( offset);
offset += 2;
}
else if (PayloadLength == 127)
@ -158,7 +158,7 @@ namespace Esiur.Net.Packets
return length - needed;
}
PayloadLength = DC.GetInt64(data, offset);
PayloadLength = data.GetInt64(offset);
offset += 8;
}