Commit ddf40c33 authored by Stewart Brodie's avatar Stewart Brodie
Browse files

Experimental change to handle Internet modules in flash.

Detail:
  This module was ignoring the possibility of the Internet module being
    re-initialised underneath it - something which can happen if there
    is an Internet module in flash as well as main ROM.  This is an
    experimental fix for this problem.
Admin:
  Not tested.

Version 2.18. Tagged as 'LanManFS-2_18'
parent 4b49606e
/* (2.17)
/* (2.18)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 2.17
#define Module_MajorVersion_CMHG 2.18
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 09 Jan 2001
#define Module_Date_CMHG 15 Jan 2001
#define Module_MajorVersion "2.17"
#define Module_Version 217
#define Module_MajorVersion "2.18"
#define Module_Version 218
#define Module_MinorVersion ""
#define Module_Date "09 Jan 2001"
#define Module_Date "15 Jan 2001"
#define Module_ApplicationDate2 "09-Jan-01"
#define Module_ApplicationDate4 "09-Jan-2001"
#define Module_ApplicationDate2 "15-Jan-01"
#define Module_ApplicationDate4 "15-Jan-2001"
#define Module_ComponentName "LanManFS"
#define Module_ComponentPath "RiscOS/Sources/Networking/Omni/Protocols/LanManFS"
#define Module_FullVersion "2.17"
#define Module_HelpVersion "2.17 (09 Jan 2001)"
#define Module_FullVersion "2.18"
#define Module_HelpVersion "2.18 (15 Jan 2001)"
......@@ -1290,6 +1290,9 @@ static void LM_check_protocol_status(_kernel_swi_regs *r)
if (r->r[2] == protocolstatus_TERMINATING && strcmp(proto, "Internet") == 0) {
NB_InternetGone();
}
else if (r->r[2] == protocolstatus_STARTING && strcmp(proto, "Internet") == 0) {
NB_InternetInit();
}
}
......
......@@ -1010,8 +1010,10 @@ static void NameStatusReply ( struct NBNS_packet *pNBP,
while( pSR->spaces_left > 0 && n-- > 0 )
{
#ifdef DEBUG
char namebuf[32];
dprintf((__FILE__, "Found %s\n", debug_name_buf(dp, namebuf)));
#endif
/* dp points to a network name */
if ( pSR->nt_search == ANY_NAME_TYPE ||
pSR->nt_search == dp[15] )
......@@ -1201,7 +1203,9 @@ int EventFn_handler ( _kernel_swi_regs *R, void *pw )
(void) pw;
if ( R->r[0] == Internet_Event &&
R->r[1] == 1 && /* ensure it was the data arrived event! */
R->r[2] == NBNS_Socket &&
NBNS_Socket != INVALID_SOCKET &&
!CallbackSet )
{
STAT(STA_IP_EVENTS);
......@@ -1224,7 +1228,7 @@ int NBIP_CallbackFn_handler(void)
CallbackSet = false;
while (1) /* Do as many packets as we can */
while (NBNS_Socket != INVALID_SOCKET) /* Do as many packets as we can */
{
tv.tv_sec=0;
tv.tv_usec=0;
......@@ -2201,6 +2205,36 @@ static void _NB_InternetGone(void)
NB_Sessions[i].LinkOK = false;
}
}
NBNS_Socket = INVALID_SOCKET;
}
/* NB_InternetInit() ---------------------------
The Internet module has arrived. Mark all sessions as disconnected and
try to re-initialise things. However, we must be careful - only do this
if we saw the old Internet module dying, because this might just be the
main ROM one sending the service call on a callback. We must only reinit
if we saw a dying service call.
*/
static void _NB_InternetInit(void)
{
if (NBNS_Socket == INVALID_SOCKET)
{
int i;
for (i=0; i < MAX_SESSIONS; ++i) {
if (NB_Sessions[i].status == SESS_CONNECTED) {
NB_Sessions[i].sid = -1;
NB_Sessions[i].LinkOK = false;
}
}
_NB_Startup();
}
}
/* Setup routine ------------------------------- */
......@@ -2230,6 +2264,5 @@ void NB_NBIP_Setup ( void )
p->pfnFindNames = _NB_FindNames;
p->pfnDescribeLink = _NB_DescribeLink;
p->pfnInternetGone = _NB_InternetGone;
p->pfnInternetInit = _NB_InternetInit;
}
......@@ -1344,6 +1344,14 @@ static void _NB_InternetGone(void)
}
/* NB_InternetGone() --------------------------- */
static void _NB_InternetInit(void)
{
/* We don't care - we're the protocol module? */
}
/* Setup routine ------------------------------- */
static struct NETBIOS_TRANSPORT NetBEUI_Transport;
......@@ -1371,5 +1379,6 @@ void NB_NetBEUI_Setup ( void )
p->pfnFindNames = _NB_FindNames;
p->pfnDescribeLink = _NB_DescribeLink;
p->pfnInternetGone = _NB_InternetGone;
p->pfnInternetInit = _NB_InternetInit;
}
#endif
......@@ -97,6 +97,7 @@ struct NETBIOS_TRANSPORT
int timeout );
char * (*pfnDescribeLink) ( hSESSION hS );
void (*pfnInternetGone) ( void );
void (*pfnInternetInit) ( void );
};
/* Definitions for supplied transports ------------------------- */
......@@ -135,3 +136,4 @@ extern void NB_NBIP_Setup(void);
#define NB_DescribeLink(a) (NB_ActiveTransport->pfnDescribeLink(a))
#define NB_InternetGone(a) (NB_ActiveTransport->pfnInternetGone(a))
#define NB_InternetInit(a) (NB_ActiveTransport->pfnInternetInit(a))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment