Hello [EMAIL PROTECTED]!

On 29-Feb-00, you wrote:

 i> If someone knows what to do about it, please let me know.

Just some ideas, let me know if it works:

 i> freenet-protocol: make Root-Protocol [
 i>   Scheme: 'freenet
 i>   protocol: rejoin [system/script/header/protocol-name " "
 i> system/script/header/protocol-version newline]

 i>   Port-id: 10000
 i>   Port-flags: system/standard/port-flags/direct

      Port-flags: system/standard/port-flags/pass-thru

[...]

 i>   open: func [
 i>      {Open the socket connection and confirm server
 i> response.}
 i>      port "Initalized port spec"
 i>      /locals sub-port data in-bypass find-bypass bp
 i> buffer-length buffer
 i>   ][
 i>      open-proto port

I think there's no point in using open-proto here, since proxy
support would need some work below too... anyway, I'm no expert
here, so... :-)

 i>      port/state/with: "^/"
 i>      port/sub-port/state/with: "^/"

add:

         port/port-flags: port/port-flags or Port-flags

[...]

 i>   read: func [
 i>      port [port!]   "The port object"
 i>      data [string!] "A buffer"
 i>      /local messageid hopstolive depth searchkey
 i>      command local-port-num ap c
 i>   ][

change to:

      copy: func [
         port
         /local messageid hopstolive depth searchkey
            command local-port-num ap c
      ] [
         
 i>      local-port-num: find-port

change to:

         ap: system/words/open tcp://:0
         local-port-num: ap/port-id

 i>      MessageID: make-id
 i>      HopsToLive: 256
 i>      depth: 50
 i>      SearchKey: to-string either none? port/path [
 i> port/target ] [rejoin [port/path port/target]]

 i>      buffer-length: 2000
 i>      answer: make string! buffer-length

 i>      command: rejoin [
 i>         "DataRequest" newline
 i>         "Source=tcp/" system/network/host ":" local-port-num
 i> newline
 i>         "SearchKey=" SearchKey newline
 i>         "UniqueID=" MessageID newline
 i>         "Depth=" depth newline
 i>         "HopsToLive=" HopsToLive newline
 i>      ]

remove the line: 

 i>      ap: system/words/open rejoin [ tcp://: local-port-num ]

 i>      ;insert port/sub-port command
 i>      write-io port/sub-port command length? command

 i>      system/words/close port

try using system/words/close port/sub-port; you should reopen it
after, or copy will work once only.

 i>      wait ap
 i>      c: first ap

the wait is not needed.

 i>      write-io c protocol length? protocol

 i>      answer: copy c

 i>      close c
 i>      close ap

 i>      either parse answer [ "DataReply" newline to end ] [
 i>         parse answer [ thru "Data^/" copy answer to end ]
 i>      ] [
 i>         answer: none
 i>      ]

replace this:

 i>      probe answer

 i>      ; FIXME: 
 i>      ; prevents port not open error ...
 i>      halt
 i>   ] ; read

with just:

         answer
      ]

 i>   write: func [
 i>      port [port!]   "The port object"
 i>      data [string!] "A buffer"
 i>      /local messageid hopstolive depth searchkey
 i>      command local-port-num ap c
 i>   ][

replace with:

      insert: func [
         port data
         /local messageid hopstolive depth searchkey
             command local-port-num ap c
      ] [

 i>      local-port-num: find-port

see above...

 i>      MessageID: make-id
 i>      HopsToLive: 256
 i>      depth: 50
 i>      SearchKey: to-string either none? port/path [
 i> port/target ] [rejoin [port/path port/target]]

 i>      buffer-length: 100
 i>      answer: make string! buffer-length

 i>      command: rejoin [
 i>         "DataInsert" newline
 i>         "DataSource=tcp/" port/host ":" port/port-id newline
 i>         "Source=tcp/" system/network/host ":" local-port-num
 i> newline
 i>         "SearchKey=" SearchKey newline
 i>         "UniqueID=" MessageID newline
 i>         "Depth=" depth newline
 i>         "HopsToLive=" HopsToLive newline
 i>         "Data" newline
 i>         data
 i>      ]

 i>      ap: system/words/open rejoin [ tcp://: local-port-num ]

 i>      write-io port/sub-port command length? command

 i>      close port

see above...

 i>      wait ap
 i>      c: first ap
 i>      write-io c protocol length? protocol

 i>      answer: copy c

 i>      close c
 i>      close ap

 i>      ;      probe answer
 i>      halt
 i>   ] ; write

I think you can return answer here too (even if returning data
from insert is not consistent with other protocols)

 i>   ; install the protocol
 i>   net-utils/net-install freenet self 10000
 i> ]
 i> ; --- Script ending above this line  ---
 i> halt

HTH,
    Gabriele.
-- 
o--------------------) .-^-. (----------------------------------o
| Gabriele Santilli / /_/_\_\ \ Amiga Group Italia --- L'Aquila |
| GIESSE on IRC     \ \-\_/-/ /  http://www.amyresource.it/AGI/ |
o--------------------) `-v-' (----------------------------------o

Reply via email to