From 238ac2563b44f0da87284ff3beccd85e4a9aaf56 Mon Sep 17 00:00:00 2001 From: Ahmed Zamil Date: Mon, 11 Nov 2019 12:50:10 +0300 Subject: [PATCH] Fix --- Esiur.Stores.MongoDB/MongoDBStore.cs | 3 +++ Esiur/Net/IIP/DistributedConnection.cs | 8 +++++--- Esiur/Net/IIP/DistributedConnectionProtocol.cs | 2 +- Esiur/Net/NetworkServer.cs | 9 ++++++++- Esiur/Resource/Warehouse.cs | 4 ++-- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Esiur.Stores.MongoDB/MongoDBStore.cs b/Esiur.Stores.MongoDB/MongoDBStore.cs index b09f5fd..8a75777 100644 --- a/Esiur.Stores.MongoDB/MongoDBStore.cs +++ b/Esiur.Stores.MongoDB/MongoDBStore.cs @@ -299,6 +299,9 @@ namespace Esiur.Stores.MongoDB public bool Put(IResource resource) { + if (resource == this) + return true; + PutResource(resource).Wait(); return true; diff --git a/Esiur/Net/IIP/DistributedConnection.cs b/Esiur/Net/IIP/DistributedConnection.cs index 3c7e918..4d290d8 100644 --- a/Esiur/Net/IIP/DistributedConnection.cs +++ b/Esiur/Net/IIP/DistributedConnection.cs @@ -790,11 +790,13 @@ namespace Esiur.Net.IIP if (Instance.Attributes.ContainsKey("username") && Instance.Attributes.ContainsKey("password")) { - var hostname = String.Join("://", Instance.Name.Split(new string[] { "://" }, StringSplitOptions.None).Skip(1)).Split('/')[0]; + //var hostname = String.Join("://", Instance.Name.Split(new string[] { "://" }, StringSplitOptions.None).Skip(1)).Split('/')[0]; // assign domain from hostname if not provided - var address = hostname.Split(':')[0]; - var port = ushort.Parse(hostname.Split(':')[1]); + var host = Instance.Name.Split(':'); + + var address = host[0];// hostname.Split(':')[0]; + var port = ushort.Parse(host[1]);// hostname.Split(':')[1]); var username = Instance.Attributes["username"].ToString(); var domain = Instance.Attributes.ContainsKey("domain") ? Instance.Attributes["domain"].ToString() : address; diff --git a/Esiur/Net/IIP/DistributedConnectionProtocol.cs b/Esiur/Net/IIP/DistributedConnectionProtocol.cs index 7c0bc88..758ca0e 100644 --- a/Esiur/Net/IIP/DistributedConnectionProtocol.cs +++ b/Esiur/Net/IIP/DistributedConnectionProtocol.cs @@ -1153,7 +1153,7 @@ namespace Esiur.Net.IIP } catch (Exception ex) { - SendError(ErrorType.Exception, callback, 0, ex.ToString()); + SendError(ErrorType.Exception, callback, 0, ex.InnerException.ToString()); return; } diff --git a/Esiur/Net/NetworkServer.cs b/Esiur/Net/NetworkServer.cs index b5c118b..0011767 100644 --- a/Esiur/Net/NetworkServer.cs +++ b/Esiur/Net/NetworkServer.cs @@ -294,7 +294,14 @@ namespace Esiur.Net c.Assign(sock); - ClientConnected(c); + try + { + ClientConnected(c); + } + catch + { + // something wrong with the child. + } // Accept more listener.Accept().Then(NewConnection); diff --git a/Esiur/Resource/Warehouse.cs b/Esiur/Resource/Warehouse.cs index 6453e60..4275553 100644 --- a/Esiur/Resource/Warehouse.cs +++ b/Esiur/Resource/Warehouse.cs @@ -426,8 +426,8 @@ namespace Esiur.Resource if (resource is IStore) StoreConnected?.Invoke(resource as IStore, name); - else - store.Put(resource); + //else + store.Put(resource); if (parent != null)