diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2021-12-29 16:56:46 +0100 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2021-12-29 16:56:46 +0100 |
commit | c244759655e2b9df21f0088852c9bbf02739a798 (patch) | |
tree | 717c1ae42395745cba262d4fe966602515fcc13c | |
parent | 52754000569383b24e2e7b4644cbaaf2d24b35d9 (diff) | |
download | lsd0004-c244759655e2b9df21f0088852c9bbf02739a798.tar.gz lsd0004-c244759655e2b9df21f0088852c9bbf02739a798.zip |
update result processing
-rw-r--r-- | draft-schanzen-r5n.xml | 75 |
1 files changed, 44 insertions, 31 deletions
diff --git a/draft-schanzen-r5n.xml b/draft-schanzen-r5n.xml index f7a953f..822be85 100644 --- a/draft-schanzen-r5n.xml +++ b/draft-schanzen-r5n.xml | |||
@@ -595,10 +595,10 @@ END | |||
595 | </section> | 595 | </section> |
596 | <section anchor="p2p_xq" numbered="true" toc="default"> | 596 | <section anchor="p2p_xq" numbered="true" toc="default"> |
597 | <name>Extended query</name> | 597 | <name>Extended query</name> |
598 | <t>TODO: What is this for? Not documented anywhere</t> | 598 | <t>TODO: Talk about XQuery in the context of messages.</t> |
599 | </section> | 599 | </section> |
600 | <section anchor="p2p_put" numbered="true" toc="default"> | 600 | <section anchor="p2p_put" numbered="true" toc="default"> |
601 | <name>PUT message</name> | 601 | <name>PutMessage</name> |
602 | <section anchor="p2p_put_wire"> | 602 | <section anchor="p2p_put_wire"> |
603 | <name>Wire Format</name> | 603 | <name>Wire Format</name> |
604 | <figure anchor="figure_putmsg"> | 604 | <figure anchor="figure_putmsg"> |
@@ -736,7 +736,7 @@ END | |||
736 | </section> | 736 | </section> |
737 | </section> | 737 | </section> |
738 | <section anchor="p2p_get" numbered="true" toc="default"> | 738 | <section anchor="p2p_get" numbered="true" toc="default"> |
739 | <name>GET Message</name> | 739 | <name>GetMessage</name> |
740 | <section anchor="p2p_get_wire"> | 740 | <section anchor="p2p_get_wire"> |
741 | <name>Wire Format</name> | 741 | <name>Wire Format</name> |
742 | <figure anchor="figure_getmsg"> | 742 | <figure anchor="figure_getmsg"> |
@@ -877,7 +877,7 @@ END | |||
877 | </section> | 877 | </section> |
878 | </section> | 878 | </section> |
879 | <section anchor="p2p_result" numbered="true" toc="default"> | 879 | <section anchor="p2p_result" numbered="true" toc="default"> |
880 | <name>RESULT message</name> | 880 | <name>ResultMessage</name> |
881 | <section anchor="p2p_result_wire"> | 881 | <section anchor="p2p_result_wire"> |
882 | <name>Wire Format</name> | 882 | <name>Wire Format</name> |
883 | <figure anchor="figure_resmsg"> | 883 | <figure anchor="figure_resmsg"> |
@@ -968,48 +968,61 @@ END | |||
968 | <section anchor="p2p_result_processing"> | 968 | <section anchor="p2p_result_processing"> |
969 | <name>Processing</name> | 969 | <name>Processing</name> |
970 | <t> | 970 | <t> |
971 | Upon receiving a RESULT message from a connected peer. An implementation | 971 | Upon receiving a <tt>ResultMessage</tt> from a connected peer. |
972 | MUST process it step by step as follows: | 972 | An implementation MUST process it step by step as follows: |
973 | </t> | 973 | </t> |
974 | <ol> | 974 | <ol> |
975 | <li> | 975 | <li> |
976 | The EXPIRATION field is evaluated. If the message is expired, | 976 | The <tt>EXPIRATION</tt> field is evaluated. |
977 | it MUST be discarded. | 977 | If the message is expired, it MUST be discarded. |
978 | </li> | 978 | </li> |
979 | <li> | 979 | <li> |
980 | If the MTYPE of the message indicates a HELLO block, the | 980 | If the MTYPE of the message indicates a HELLO block, it |
981 | payload MUST be considered for the local routing table. | 981 | must be validated according to <xref target="hello_block"/>. |
982 | FIXME: Considered how? | 982 | The payload MUST be considered for the local routing table by |
983 | trying to establish a connection to the peer using the information | ||
984 | from the HELLO block. If a connection can be established, | ||
985 | the peer is added to the <tt>KBuckets</tt> routing table. | ||
983 | </li> | 986 | </li> |
984 | <li> | 987 | <li> |
985 | If the sender peer (FIXME which peer?) is already found in the | 988 | If the sender peer of the message is already found in the |
986 | GETPATH, the path MUST be truncated. | 989 | GETPATH, the path MUST be truncated at this position. |
990 | The implementation MAY log a warning in such a case. | ||
987 | </li> | 991 | </li> |
988 | <li> | 992 | <li> |
989 | If the KEY of this PUT message is found in the list of pending | 993 | If the <tt>KEY</tt> of this <tt>ResultMessage</tt> is found in the |
990 | queries, the the KEY and XQUERY is validated against the requested | 994 | list of pending local queries, the <tt>KEY</tt> and <tt>XQUERY</tt> |
991 | BTYPE. | 995 | are validated against the requested BTYPE using the respective |
996 | block type implementation of <tt>ValidateBlockReply</tt>. | ||
992 | If the BTYPE is not supported, or if the block key | 997 | If the BTYPE is not supported, or if the block key |
993 | does not match the BTYPE or if the XQUERY is malformed, | 998 | does not match the BTYPE or if the XQUERY is malformed, |
994 | the message MUST be discarded. (FIXME: It is not clear the key | 999 | the message MUST be discarded. |
995 | validation is happening. However, block validation is.) | ||
996 | </li> | 1000 | </li> |
997 | <li> | 1001 | <li> |
998 | The implementation MAY cache RESULT messages. | 1002 | The implementation MAY cache RESULT messages. |
999 | </li> | 1003 | </li> |
1000 | <li> | 1004 | <li> |
1001 | If no requests for this KEY or BTYPE are known, result processing | 1005 | <t> |
1002 | is completed. | 1006 | If requests by other peers for this KEY or BTYPE are known, |
1003 | </li> | 1007 | the result block is validated against each request using |
1004 | <li> | 1008 | the respective <tt>ValidateBlockReply</tt> function. |
1005 | If the request is of type "Find Peer" and the message BTYPE is | 1009 | </t> |
1006 | of type HELLO the block key is extracted from BLOCK, and if the | 1010 | <t> |
1007 | block key does not match KEY or cannot be extracted because | 1011 | If the request options include <tt>FindPeer</tt> and the result |
1008 | the BLOCK is malformed, the message MUST be discarded. | 1012 | message block type is HELLO the block validation must use the |
1009 | Otherwise, the block is evaluated against the message KEY. | 1013 | key derived using <tt>DeriveBlockKey</tt> as the key included in |
1010 | FIXME: If OK_MORE or OK_LAST the RESULT is routed. One (!) peer is | 1014 | the request is only approximate. (FIXME: So we extract the key |
1011 | selected from the connected peers (!). If none is found the message | 1015 | to then check it again against the block? This does not make sense...) |
1012 | is discarded. | 1016 | </t> |
1017 | <t> | ||
1018 | If the result message block cannot be verified against the | ||
1019 | <tt>KEY</tt> of the result message or if <tt>BLOCK</tt> is | ||
1020 | malformed, the message MUST be discarded. | ||
1021 | </t> | ||
1022 | <t> | ||
1023 | For each pending request the reply is sent to the requesting | ||
1024 | peer. | ||
1025 | </t> | ||
1013 | </li> | 1026 | </li> |
1014 | </ol> | 1027 | </ol> |
1015 | </section> | 1028 | </section> |
@@ -1102,7 +1115,7 @@ END | |||
1102 | its own block type called "HELLO". A block with this block type | 1115 | its own block type called "HELLO". A block with this block type |
1103 | contains the peer ID of the peer initiating the GET request. | 1116 | contains the peer ID of the peer initiating the GET request. |
1104 | </t> | 1117 | </t> |
1105 | <section> | 1118 | <section anchor="hello_block"> |
1106 | <name>HELLO</name> | 1119 | <name>HELLO</name> |
1107 | <t> | 1120 | <t> |
1108 | The HELLO block type wire format is illustrated in | 1121 | The HELLO block type wire format is illustrated in |