Quellcode durchsuchen

Added RestPort and RPCPort properties to DatabaseInfo class

frogsoftware vor 1 Jahr
Ursprung
Commit
43306f1383

+ 17 - 1
InABox.Core/Client/Request.cs

@@ -863,6 +863,16 @@ namespace InABox.Clients
         public string Version { get; set; }
         public string Version { get; set; }
 
 
         public bool IsHTTPS { get; set; }
         public bool IsHTTPS { get; set; }
+        
+        
+        // Ideally, we should not need these.  However, there is currently a bug in RPCServer
+        // that crashes the server when uploading large files (ie photos)
+        // So we need to be a able to maintain both a Rest and RPC-style connection
+        // to the server to try and have both session (RPC) capabilities
+        // as well as having stable upload performance :-(
+        // Once the RPC listeners are stable, then this needs to be removed.
+        public int RestPort { get; set; }
+        public int RPCPort { get; set; }
 
 
         [JsonConstructor]
         [JsonConstructor]
         public DatabaseInfo()
         public DatabaseInfo()
@@ -870,12 +880,14 @@ namespace InABox.Clients
 
 
         }
         }
 
 
-        public DatabaseInfo(string? colorScheme, byte[]? logo, string version, bool isHTTTPS)
+        public DatabaseInfo(string? colorScheme, byte[]? logo, string version, bool isHTTTPS, int restPort, int rpcPort)
         {
         {
             ColorScheme = colorScheme;
             ColorScheme = colorScheme;
             Logo = logo;
             Logo = logo;
             Version = version;
             Version = version;
             IsHTTPS = isHTTTPS;
             IsHTTPS = isHTTTPS;
+            RestPort = restPort;
+            RPCPort = rpcPort;
         }
         }
 
 
         public void SerializeBinary(CoreBinaryWriter writer)
         public void SerializeBinary(CoreBinaryWriter writer)
@@ -894,6 +906,8 @@ namespace InABox.Clients
 
 
             writer.Write(Version);
             writer.Write(Version);
             writer.Write(IsHTTPS);
             writer.Write(IsHTTPS);
+            writer.Write(RestPort);
+            writer.Write(RPCPort);
         }
         }
         public void DeserializeBinary(CoreBinaryReader reader)
         public void DeserializeBinary(CoreBinaryReader reader)
         {
         {
@@ -904,6 +918,8 @@ namespace InABox.Clients
 
 
             Version = reader.ReadString();
             Version = reader.ReadString();
             IsHTTPS = reader.ReadBoolean();
             IsHTTPS = reader.ReadBoolean();
+            RestPort = reader.ReadInt32();
+            RPCPort = reader.ReadInt32();
         }
         }
     }
     }
     
     

+ 7 - 1
InABox.Database/DbFactory.cs

@@ -20,7 +20,13 @@ namespace InABox.Database
         
         
         public static string? ColorScheme { get; set; }
         public static string? ColorScheme { get; set; }
         public static byte[]? Logo { get; set; }
         public static byte[]? Logo { get; set; }
-
+        
+        // See notes in Request.DatabaseInfo class
+        // Once RPC transport is stable, these settings need
+        // to be removed
+        public static int RestPort { get; set; }
+        public static int RPCPort { get; set; }
+        
         //public static Type[] Entities { get { return entities; } set { SetEntityTypes(value); } }
         //public static Type[] Entities { get { return entities; } set { SetEntityTypes(value); } }
         public static IEnumerable<Type> Entities
         public static IEnumerable<Type> Entities
         {
         {

+ 1 - 1
InABox.RPC.Shared/Commands/Info/RpcInfoResult.cs

@@ -7,7 +7,7 @@ namespace InABox.Rpc
     {
     {
         
         
         public DatabaseInfo? Info { get; set; }
         public DatabaseInfo? Info { get; set; }
-
+        
         public void SerializeBinary(CoreBinaryWriter writer)
         public void SerializeBinary(CoreBinaryWriter writer)
         {
         {
             writer.WriteBinaryValue(Info);
             writer.WriteBinaryValue(Info);

+ 1 - 1
InABox.Server/RPC/Handlers/Info.cs

@@ -12,7 +12,7 @@ namespace InABox.Rpc
         {
         {
             var response = new RpcInfoResult()
             var response = new RpcInfoResult()
             {
             {
-                Info = new DatabaseInfo(DbFactory.ColorScheme, DbFactory.Logo, CoreUtils.GetVersion(), Sender.IsSecure())
+                Info = new DatabaseInfo(DbFactory.ColorScheme, DbFactory.Logo, CoreUtils.GetVersion(), Sender.IsSecure(), DbFactory.RestPort, DbFactory.RPCPort)
             };
             };
             
             
             return response;
             return response;

+ 1 - 1
InABox.Server/RestService.cs

@@ -208,7 +208,7 @@ namespace InABox.API
 
 
         public static InfoResponse Info(InfoRequest request)
         public static InfoResponse Info(InfoRequest request)
         {
         {
-            var response = new InfoResponse(new DatabaseInfo(DbFactory.ColorScheme, DbFactory.Logo, CoreUtils.GetVersion(), IsHTTPS));
+            var response = new InfoResponse(new DatabaseInfo(DbFactory.ColorScheme, DbFactory.Logo, CoreUtils.GetVersion(), IsHTTPS, DbFactory.RestPort, DbFactory.RPCPort));
             response.Status = StatusCode.OK;
             response.Status = StatusCode.OK;
             return response;
             return response;
         }
         }