On Sat, Apr 25, 2020, 11:46 Roelof Wobben via Pharo-users <
pharo-users@lists.pharo.org> wrote:

> Op 25-4-2020 om 20:17 schreef Roelof Wobben:
> > Op 25-4-2020 om 20:04 schreef tbrunz:
> >> 1. 'loopback' is a node, just like 'source' and 'destination'.  A
> >> network is
> >> a mesh of 'nodes' joined by 'links'.  Your Pharo program represents
> >> one of
> >> those nodes: It is the 'loopback' node.
> >
> > oke, so I can do : loopback := KNetworkNode new.
> >
> >> 2. The block in the #linksTowards:do: method is the action to take on a
> >> packet, depending on whether its destination is "you" (loopback), or
> >> something else.
> >>
> >> The flood algorithm is the simplest algorithm: "If the destination is
> >> not
> >> me, send the packet to everyone else (except the one who sent it to
> >> me)."
> >
> >
> > and that part I still do not see. I "fail"  to see what the block
> > exactly is.
> >
> >> However, there is the possibility of loops in the network, so a slightly
> >> better algorithm is to check "have I seen this packet before?" and if
> >> the
> >> answer is "yes", then drop it; otherwise send it via my links. This will
> >> prevent endless packet sending loops in your network.
> >>
> >> -t
> >>
> >>
> >>
> >>
> >> --
> >> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
> >>
> >
>
>
>
> Oke,
>
> Did some thinking and see how things are working if the loopback is not
> used :
>
> linksTowards: anAddress do: aBlock
>      "Simple flood algorithm: route via all outgoing links.
> However, just loopback if the receiver node is the routing destination."
>
>      address = anAddress
>          ifTrue: [  ]
>          ifFalse: [ outgoingLinks do: aBlock ]
>
> but still I "fail"  to see what need to be done when the loopback is
> used with the block.
>

It's not clear to me if a link is an actual object in your model. I'll
respond as if it is.

aBlock is the work you want done on the destination node. So, the question
is how you get it there. You iterate through the outgoingLinks and ask the
link to deliver the block to the destination node. In "blasting", each node
sends it on through its own outgoingLinks, until it eventually reaches the
destination node.

The destination node evaluates aBlock, probably supplying itself as an
argument to the block.

In the case of a loopback, the node itself seems to be the one intended to
evaluate aBlock. (I don't know the problem description, so that may not be
entirely correct.)


> Roelof
>
>
>

Reply via email to