mirror of
https://github.com/ShadowKatStudios/OC-Minitel.git
synced 2024-11-23 02:28:05 +11:00
implemented broadcasts
This commit is contained in:
parent
3d45735361
commit
2174105d30
@ -22,6 +22,7 @@ local dbug = false
|
||||
local modems = {}
|
||||
local port = 4096
|
||||
local retry = 30
|
||||
local route = true
|
||||
|
||||
--[[
|
||||
LKR format:
|
||||
@ -136,14 +137,16 @@ function start()
|
||||
if packetType ~= 2 then
|
||||
computer.pushSignal("net_msg",sender,vport,data)
|
||||
end
|
||||
else
|
||||
elseif dest:sub(1,1) == "~" then -- broadcasts start with ~
|
||||
computer.pushSignal("net_broadcast",sender,vport,data)
|
||||
elseif route then -- repeat packets if route is enabled
|
||||
sendPacket(packetID,packetType,dest,sender,vport,data)
|
||||
end
|
||||
if not rcache[sender] then
|
||||
if not rcache[sender] then -- add the sender to the rcache
|
||||
dprint("rcache: "..sender..":", localModem,from,computer.uptime())
|
||||
rcache[sender] = {localModem,from,computer.uptime()+rctime}
|
||||
end
|
||||
if not pcache[packetID] then
|
||||
if not pcache[packetID] then -- add the packet ID to the pcache
|
||||
pcache[packetID] = computer.uptime()+pctime
|
||||
end
|
||||
end
|
||||
|
@ -34,12 +34,12 @@ It is recommended to keep the data in the cache for 30 seconds or so, then drop
|
||||
When sending a message, check the cache for the given destination. If there is a hardware address in the cache for the destination, send the message straight to that address. Otherwise, broadcast the message.
|
||||
|
||||
### Optional: Broadcast address
|
||||
Packets addressed to the broadcast address, an address of just the tilde character, `~`, ASCII 126, can optionally be received by all nodes of the same layer 2 network. While a node MAY forward a broadcast packet to other nodes, it SHOULD NOT, unless both sides of the forward are prepared to handle such a packet, to avoid it going around the entire layer 3 network.
|
||||
Packets addressed to the broadcast address, an address beginning with the tilde character, `~`, ASCII 126, can optionally be received by all nodes of the same layer 2 network. While a node MAY forward a broadcast packet to other nodes, it SHOULD NOT, unless both sides of the forward are prepared to handle such a packet, to avoid it going around the entire layer 3 network.
|
||||
|
||||
### Optional: Multicast
|
||||
A multicast packet has a specially formatted address part.
|
||||
The address must be a list of valid addresses, seperated by the tilde character, `~`, ASCII 126.
|
||||
For example, to send to nodes `a` and `b`, the address in the packet would be `a~b`.
|
||||
The address must be a list of valid addresses, beginning with `~` seperated by the tilde character, `~`, ASCII 126.
|
||||
For example, to send to nodes `a` and `b`, the address in the packet would be `~a~b`.
|
||||
|
||||
Each node should send multicasts as layer 2 broadcasts, unless it is known (using the address cache) that all layer 3 destination addresses have to be sent to or forwarded by one layer 2 address.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user