next up previous
Next: Problems with Floyd's Up: Implementation of Floyd Previous: Perl Libraries for

Floyd Code

On top of this base of generic libraries, the code for Floyd adds specific functionality necessary for his tasks. The generic library code itself is 12k: Floyd's particular code is another 18k. Much of the extra code has to do with fulfilling spoken requests: things like answering a request for help or submitting a broadcast message to see what other Floyds are running. In addition, Floyd implements a new set of UDP messages for the Floyd protocol, as described in the section on Floyd design. The protocol is handled by passing UDP messages through the same table mechanism described above for processing speech: protocol responses are then handled by special Floyd functions.

Floyd's response to UDP messages are fairly simple: for instance, if he receives a last Dave request, Floyd simply replies to the requester with a lastwas :Dave-1 time-last-seen. Things are more complicated when Floyd needs to send a broadcast query to collect information: it is not enough for him to passively listen to all UDP receives, he needs to listen specifically for answers to the pending query.

The current implementation of collecting replies is a combination of using random session keys to match responses to specific broadcast queries and using a fixed-length timeout to know when to stop listening for replies. When Floyd receives a user request that will require a Floyd broadcast, he generates a random number and uses that as a session key. This session key is put into the broadcast request; responding Floyds need to return the same key in their replies. The requesting Floyd then listens for all UDP messages that have the correct session key and buffers the replies. After a certain length of time (30 seconds by default), Floyd times out via a message scheduled by When energy and reports all the replies he has received.



next up previous
Next: Problems with Floyd's Up: Implementation of Floyd Previous: Perl Libraries for



Formatted: Thu Dec 14 16:41:29 MST 1995
Nelson Minar <nelson@santafe.edu>