Billy Barrow пре 3 година
родитељ
комит
80d113bfc6

+ 5 - 0
src/lib/Protocols/AIP/Answer.vala

@@ -15,6 +15,8 @@ namespace LibPeer.Protocols.Aip {
             var dos = new DataOutputStream(stream);
             dos.byte_order = DataStreamByteOrder.BIG_ENDIAN;
 
+            dos.write_bytes(in_reply_to);
+
             dos.put_int32(data.length);
             dos.put_byte((uint8)path.length);
 
@@ -34,6 +36,7 @@ namespace LibPeer.Protocols.Aip {
 
             var data_length = dis.read_int32();
             var path_size = dis.read_byte();
+            print(@"Reading $(path_size) instance references\n");
 
             path = new InstanceReference[path_size];
 
@@ -41,6 +44,8 @@ namespace LibPeer.Protocols.Aip {
                 path[i] = new InstanceReference.from_stream(dis);
             }
 
+            print(@"Reading $(data_length) bytes of answer data\n");
+
             data = dis.read_bytes(data_length);
         }
 

+ 4 - 1
src/lib/Protocols/AIP/ApplicationInformationProtocol.vala

@@ -328,7 +328,8 @@ namespace LibPeer.Protocols.Aip {
                 var query = queries.get(answer.in_reply_to);
 
                 // Get instance information from the answer
-                var info = new InstanceInformation.from_stream(new MemoryInputStream.from_bytes(answer.data));
+                var answer_stream = new MemoryInputStream.from_bytes(answer.data);
+                var info = new InstanceInformation.from_stream(answer_stream);
 
                 // Notify the query's subject listeners
                 query.on_answer(info);
@@ -339,6 +340,8 @@ namespace LibPeer.Protocols.Aip {
                 // Put it back on its path
                 send_answer(answer);
             }
+
+            print("Answer handled!\n");
         }
 
         protected void handle_request(StpInputStream stream) throws IOError, Error {

+ 3 - 2
src/lib/Protocols/AIP/InstanceInformation.vala

@@ -24,7 +24,7 @@ namespace LibPeer.Protocols.Aip {
             // Write number of connection methods
             dos.put_byte((uint8)connection_methods.length);
 
-            print("Connection methods\n");
+            print(@"$(connection_methods.length) Connection methods\n");
             // Write connection methods
             foreach (var method in connection_methods) {
                 method.serialise(dos);
@@ -40,11 +40,12 @@ namespace LibPeer.Protocols.Aip {
 
             // Read number of connection methods
             var method_count = dis.read_byte();
+            print(@"Reading $(method_count) connection methods\n");
 
             // Read conneciton methods
             connection_methods = new PeerInfo[method_count];
             for (int i = 0; i < method_count; i++) {
-                connection_methods[i] = PeerInfo.deserialise(stream);
+                connection_methods[i] = PeerInfo.deserialise(dis);
             }
         }