changeset 51:486683ead53f

bug survey
author riono <e165729@ie.u-ryukyu.ac.jp>
date Tue, 11 Jan 2022 20:02:18 +0900
parents 476b6efeca5b
children ef3fd58af531
files Test/Example/FizzBuzz/Counter.cs Test/Example/FizzBuzz/FizzBuzz.cs Test/Example/FizzBuzz/StartFizzBuzz.cs Test/Example/OddEven/StarOddEven.cs Test/Example/OddEven/StartOddEven.cs codegear/InputDataGear.cs daemon/IncomingTcpConnection.cs datagear/command/PutCommand.cs datagear/command/RemoteTakeCommand.cs
diffstat 9 files changed, 50 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/Test/Example/FizzBuzz/Counter.cs	Tue Jan 11 16:43:29 2022 +0900
+++ b/Test/Example/FizzBuzz/Counter.cs	Tue Jan 11 20:02:18 2022 +0900
@@ -10,9 +10,8 @@
     public override void Run(CodeGearManager cgm) {
         if (num <= 100) {
             GetDgm("FizzBuzz").Put("num", num);
-           
-            cgm.GetLocalDGM().Put("num", num+1);
-            //Console.WriteLine("call");
+            //cgm.GetLocalDGM().Put("num", num+1);
+            //Console.WriteLine(num);
             cgm.Setup(new Counter());
         } else {
             GetDgm("FizzBuzz").Put("num", -1);
--- a/Test/Example/FizzBuzz/FizzBuzz.cs	Tue Jan 11 16:43:29 2022 +0900
+++ b/Test/Example/FizzBuzz/FizzBuzz.cs	Tue Jan 11 20:02:18 2022 +0900
@@ -18,7 +18,7 @@
         } else {
             Console.WriteLine(num);
         }
-        //GetDgm("Counter").Put("count", num+1);
+        GetDgm("Counter").Put("num", num+1);
         cgm.Setup(new FizzBuzz());
     }
 }
--- a/Test/Example/FizzBuzz/StartFizzBuzz.cs	Tue Jan 11 16:43:29 2022 +0900
+++ b/Test/Example/FizzBuzz/StartFizzBuzz.cs	Tue Jan 11 20:02:18 2022 +0900
@@ -1,4 +1,5 @@
 using System;
+using System.Threading;
 using Christie_net.annotation;
 using Christie_net.codegear;
 
@@ -14,7 +15,7 @@
         counter.Setup(new Counter());
         fizzbuzz.Setup(new FizzBuzz());
         counter.CreateRemoteDGM("FizzBuzz", "localhost", 10002);
-        //fizzbuzz.CreateRemoteDGM("Counter", "localhost", 10001);
+        fizzbuzz.CreateRemoteDGM("Counter", "localhost", 10001);
         counter.GetLocalDGM().Put("num", 1);
     }
 }
--- a/Test/Example/OddEven/StarOddEven.cs	Tue Jan 11 16:43:29 2022 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-using Christie_net.codegear;
-
-namespace Christie_net.Test.Example.OddEven {
-public class StarOddEven : StartCodeGear {
-    public StarOddEven(CodeGearManager cgm) : base(cgm) { }
-
-    public static void Main() {
-        int finishCount = 10;
-        CodeGearManager odd = CreateCgm(10001);
-        CodeGearManager even = CreateCgm(10002);
-        
-        odd.Setup(new OddCodeGear());
-        even.Setup(new EvenCodeGear());
-        odd.CreateRemoteDGM("even", "localhost", 10002);
-        even.CreateRemoteDGM("odd", "localhost", 10001);
-        
-        odd.GetLocalDGM().Put("odd", 1);
-        odd.GetLocalDGM().Put("finishCount", finishCount);
-        even.GetLocalDGM().Put("finishCount", finishCount);
-    }
-}
-}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Test/Example/OddEven/StartOddEven.cs	Tue Jan 11 20:02:18 2022 +0900
@@ -0,0 +1,22 @@
+using Christie_net.codegear;
+
+namespace Christie_net.Test.Example.OddEven {
+public class StartOddEven : StartCodeGear {
+    public StartOddEven(CodeGearManager cgm) : base(cgm) { }
+
+    public static void Main() {
+        int finishCount = 10;
+        CodeGearManager odd = CreateCgm(10001);
+        CodeGearManager even = CreateCgm(10002);
+        
+        odd.Setup(new OddCodeGear());
+        even.Setup(new EvenCodeGear());
+        odd.CreateRemoteDGM("even", "localhost", 10002);
+        even.CreateRemoteDGM("odd", "localhost", 10001);
+        
+        odd.GetLocalDGM().Put("odd", 1);
+        odd.GetLocalDGM().Put("finishCount", finishCount);
+        even.GetLocalDGM().Put("finishCount", finishCount);
+    }
+}
+}
\ No newline at end of file
--- a/codegear/InputDataGear.cs	Tue Jan 11 16:43:29 2022 +0900
+++ b/codegear/InputDataGear.cs	Tue Jan 11 20:02:18 2022 +0900
@@ -61,7 +61,7 @@
                 Attribute.IsDefined(field, typeof(Peek)) || Attribute.IsDefined(field, typeof(PeekFrom))) {
                 try {
                     field.SetValue(cg, TypeCheck(field.Name));
-                } catch {}
+                } catch { }
             }
         }
     }
--- a/daemon/IncomingTcpConnection.cs	Tue Jan 11 16:43:29 2022 +0900
+++ b/daemon/IncomingTcpConnection.cs	Tue Jan 11 20:02:18 2022 +0900
@@ -26,23 +26,24 @@
     public void Run() {
         while (true) {
             //TODO: Data長がわからないので1024で仮置き → ぴったしで読み込む必要がある
-            byte[] streamData = new byte[100000];
-
+            byte[] streamData = new byte[1000000];
+            
+            
             int length = 0;
             try {
                length = connection.stream.Read(streamData);
+               //Console.WriteLine("call:" + connection.stream.Position);
 
             } catch (Exception e) {
                 Console.WriteLine(e.StackTrace);
             }
 
-
             // データはRemotemessage(Command), length, dataの順で入っている
             //int dataLength = connection.socket.Receive(deserializeCommand);
 
             // Debug
-            Console.WriteLine("length:" + length);
-            
+            //Console.WriteLine("length:" + length);
+
             RemoteMessage msg = MessagePackSerializer.Deserialize<RemoteMessage>(streamData);
             CommandType type = CommandTypeExt.GetCommandTypeFormId(msg.type);
 
--- a/datagear/command/PutCommand.cs	Tue Jan 11 16:43:29 2022 +0900
+++ b/datagear/command/PutCommand.cs	Tue Jan 11 20:02:18 2022 +0900
@@ -26,7 +26,6 @@
             
             stream.Write(command);
 
-            stream.Position = 0;
         } catch (IOException e) {
             Console.WriteLine(e.StackTrace);
         }
--- a/datagear/command/RemoteTakeCommand.cs	Tue Jan 11 16:43:29 2022 +0900
+++ b/datagear/command/RemoteTakeCommand.cs	Tue Jan 11 20:02:18 2022 +0900
@@ -1,5 +1,7 @@
+using System;
 using System.IO;
 using Christie_net.datagear.dg;
+using MessagePack;
 
 namespace Christie_net.datagear.command {
 public class RemoteTakeCommand : Command{
@@ -12,7 +14,20 @@
     }
 
     public override byte[] Convert() {
-        throw new System.NotImplementedException();
+        MemoryStream stream = new MemoryStream();
+
+        try {
+            byte[] command = MessagePackSerializer.Serialize(CreateRemoteMessage(null));
+
+
+            stream.Write(command);
+
+            stream.Position = 0;
+        } catch (IOException e) {
+            Console.WriteLine(e.StackTrace);
+        }
+
+        return stream.ToArray();
     }
 }
 }
\ No newline at end of file