summaryrefslogtreecommitdiff
path: root/L3Code.c
diff options
context:
space:
mode:
Diffstat (limited to 'L3Code.c')
-rw-r--r--L3Code.c91
1 files changed, 75 insertions, 16 deletions
diff --git a/L3Code.c b/L3Code.c
index 7c1d5b8..0aafe67 100644
--- a/L3Code.c
+++ b/L3Code.c
@@ -60,6 +60,12 @@ VOID L3TRYNEXTDEST(struct ROUTE * ROUTE);
VOID SendNETROMRoute(struct PORTCONTROL * PORT, unsigned char * axcall);
void SendVARANetromNodes(struct TNCINFO * TNC, MESSAGE *Buffer);
void SendVARANetromMsg(struct TNCINFO * TNC,L3MESSAGEBUFFER * Buffer);
+VOID SENDNODESMSG(int Portnum);
+VOID TCPNETROMSend(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Frame);
+
+extern int NODESINPROGRESS;
+extern int NODESToOnePort;
+extern int CLOSING;
extern BOOL NODESINPROGRESS ;;
PPORTCONTROL L3CURRENTPORT;
@@ -94,7 +100,15 @@ VOID L3BG()
{
ROUTE = DEST->NRROUTE[ActiveRoute - 1].ROUT_NEIGHBOUR;
- // if NetROM over VARA pass direct to the driver
+ // if NetROM over VARA or NetROM over TCP pass direct to the driver
+
+ if (ROUTE && ROUTE->TCPPort)
+ {
+ PL3MESSAGEBUFFER Frame = (PL3MESSAGEBUFFER)Q_REM(&DEST->DEST_Q);
+ TCPNETROMSend(ROUTE, Frame);
+ ReleaseBuffer(Frame);
+ continue;
+ }
if (ROUTE)
{
@@ -222,7 +236,7 @@ BOOL ACTIVATE_DEST(struct DEST_LIST * DEST)
return L2SETUPCROSSLINK(ROUTE);
}
- // We umst be waiting for link to come up
+ // We must be waiting for link to come up
return TRUE;
@@ -241,6 +255,13 @@ char Call1[10];
char Call2[10];
char Call3[10];
+VOID PROCESSNODESPOLL(struct PORTCONTROL * PORT)
+{
+ // Pauls G8BPT's request NODES Broadcast
+
+ SENDNODESMSG(PORT->PORTNUMBER);
+ return;
+}
VOID PROCESSNODEMESSAGE(MESSAGE * Msg, struct PORTCONTROL * PORT)
{
// PROCESS A NET/ROM 'NODES' MESSAGE
@@ -606,9 +627,6 @@ VOID PROCROUTES(struct DEST_LIST * DEST, struct ROUTE * ROUTE, int Qual)
if (Index == 0)
{
// THIS IS A REFRESH OF BEST - IF THIS ISNT ACTIVE ROUTE, MAKE IT ACTIVE
-
- if (DEST->DEST_ROUTE > 1) // LEAVE IT IF NOT SELECTED OR ALREADY USING BEST
- DEST->DEST_ROUTE = 1;
}
goto UpdatateThisEntry;
@@ -707,6 +725,8 @@ SORTROUTES:
goto SORTROUTES; // 1 AND 2 MAY NOW BE WRONG!
}
+
+ DEST->DEST_ROUTE = 0; // OForce re-evaluation.
}
int COUNTNODES(struct ROUTE * ROUTE)
@@ -744,12 +764,26 @@ VOID L3BG();
VOID SENDNEXTNODESFRAGMENT();
-VOID SENDNODESMSG()
+VOID SENDNODESMSG(int Portnum)
{
if (NODESINPROGRESS)
return;
- L3CURRENTPORT = PORTTABLE;
+ NODESToOnePort = Portnum;
+
+ if (Portnum) // Nodes to one port only
+ {
+ L3CURRENTPORT = GetPortTableEntryFromPortNum(Portnum);
+
+ if (L3CURRENTPORT == 0)
+ {
+ NODESToOnePort = 0;
+ return;
+ }
+ }
+ else
+ L3CURRENTPORT = PORTTABLE;
+
SENDNEXTNODESFRAGMENT();
}
@@ -785,16 +819,19 @@ VOID SENDNEXTNODESFRAGMENT()
// No NODES to this port, so go to next
PORT = PORT->PORTPOINTER;
- if (PORT == NULL)
+
+ if (PORT == NULL || NODESToOnePort)
{
// Finished
+ NODESToOnePort = 0;
NODESINPROGRESS = 0;
return;
}
}
- L3CURRENTPORT = PORT;
+ if (NODESToOnePort == 0) // CurrentPort already set if NODESToOnePort
+ L3CURRENTPORT = PORT;
DEST = CURRENTNODE = DESTS; // START OF LIST
NODESINPROGRESS = 1;
@@ -851,13 +888,24 @@ VOID SENDNEXTNODESFRAGMENT()
if (DEST >= ENDDESTLIST)
{
CURRENTNODE = 0; // Finished on this port
- L3CURRENTPORT = PORT->PORTPOINTER;
- if (L3CURRENTPORT == NULL)
- {
- // Finished
+ // if sending to only one port then stop
+
+ if (NODESToOnePort)
+ {
+ NODESToOnePort = 0;
NODESINPROGRESS = 0;
}
+ else
+ {
+ L3CURRENTPORT = PORT->PORTPOINTER;
+ if (L3CURRENTPORT == NULL)
+ {
+ // Finished
+
+ NODESINPROGRESS = 0;
+ }
+ }
goto Sendit;
}
@@ -951,7 +999,9 @@ VOID CLEARACTIVEROUTE(struct ROUTE * ROUTE, int Reason)
dest_list * DEST;
int n;
- if (Reason != NORMALCLOSE || ROUTE->INP3Node)
+ // If a link restarts and is no longer inp3 we must still clear any inp3 routes
+
+// if (Reason != NORMALCLOSE || ROUTE->INP3Node)
TellINP3LinkGone(ROUTE);
DEST = DESTS;
@@ -991,7 +1041,8 @@ VOID L3TimerProc()
LINK = LINKS;
i = MAXLINKS;
- while (i--);
+
+ while (i--)
{
if (LINK->LINKTYPE == 3) // Only if Internode
{
@@ -1044,7 +1095,7 @@ VOID L3TimerProc()
L3TIMER = L3INTERVAL;
UPDATEDESTLIST();
- SENDNODESMSG();
+ SENDNODESMSG(0);
}
}
@@ -1082,6 +1133,11 @@ VOID L3FastTimer()
MESSAGE * Msg;
struct PORTCONTROL * PORT = PORTTABLE;
+ // Not if Node is closing
+
+ if (CLOSING)
+ return;
+
INP3TIMER();
// Send Node faster if VARA
@@ -1254,6 +1310,9 @@ VOID REMOVENODE(dest_list * DEST)
while (DEST->DEST_Q)
ReleaseBuffer(Q_REM(&DEST->DEST_Q));
+ if (DEST->DEST_STATE & 0x80) // LOCKED DESTINATION
+ return;
+
// MAY NEED TO CHECK FOR L4 CIRCUITS USING DEST, BUT PROBABLY NOT,
// AS THEY SHOULD HAVE TIMED OUT LONG AGO