XNSRefreshGatewayTranslationCaches.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Demers, December 10, 1986 1:22:48 pm PST
This is a kludge to get XNS stream creation to work okay from 3Mb nets despite the short timeout of the gateway translation caches. The idea is periodically to ping each gateway with a translation request packet (calling network.getEncapsulation[...] does this as a side effect).
DIRECTORY
Process USING [Abort, Pause, SecondsToTicks, Ticks],
XNS USING [Host, Net, unknownHost, unknownSocket],
XNSRouter USING [Enumerate, RoutingTableEntry],
XNSRouterPrivate USING [Network, Route];
XNSRefreshGatewayTranslationCaches: CEDAR MONITOR
IMPORTS Process, XNSRouter, XNSRouterPrivate
~ BEGIN
Daemon to ping all routers on directly connected nets
worker: PROCESSNIL;
workerSweepSeconds: INT ← 150;
workerSweepTicks: Process.Ticks ← Process.SecondsToTicks[workerSweepSeconds];
Start: ENTRY PROC ~ {
ENABLE UNWIND => NULL;
IF worker = NIL THEN worker ← FORK Worker[];
};
Stop: ENTRY PROC ~ {
ENABLE UNWIND => NULL;
IF worker # NIL THEN TRUSTED {
Process.Abort[worker]; JOIN worker; worker ← NIL };
};
Worker: PROC ~ {
EachEntry: PROC[net: XNS.Net, entry: XNSRouter.RoutingTableEntry] ~ {
network: XNSRouterPrivate.Network;
host: XNS.Host;
[network, host] ← XNSRouterPrivate.Route[
[net~net, host~XNS.unknownHost, socket~XNS.unknownSocket]];
IF network.xns.translation = NIL THEN RETURN;
[] ← network.xns.getEncapsulation[network, host];
};
DO
XNSRouter.Enumerate[proc~EachEntry];
Process.Pause[workerSweepTicks];
ENDLOOP;
};
Start[];
END.