Use a global variable, ipxpcb_lport_cache, to cache the most recently

used IPX port number, rather than using the global ipxpcb list head.
This commit is contained in:
rwatson 2004-12-30 17:54:53 +00:00
parent 767b9c0b3e
commit a163a92e00
2 changed files with 6 additions and 5 deletions

View File

@ -88,6 +88,7 @@ struct sockaddr_ipx ipx_netmask, ipx_hostmask;
/*
* IPX protocol control block (pcb) lists.
*/
u_short ipxpcb_lport_cache;
struct ipxpcbhead ipxpcb_list;
struct ipxpcbhead ipxrawpcb_list;

View File

@ -110,11 +110,11 @@ ipx_pcbbind(ipxp, nam, td)
noname:
if (lport == 0)
do {
ipxpcb.ipxp_lport++;
if ((ipxpcb.ipxp_lport < IPXPORT_RESERVED) ||
(ipxpcb.ipxp_lport >= IPXPORT_WELLKNOWN))
ipxpcb.ipxp_lport = IPXPORT_RESERVED;
lport = htons(ipxpcb.ipxp_lport);
ipxpcb_lport_cache++;
if ((ipxpcb_lport_cache < IPXPORT_RESERVED) ||
(ipxpcb_lport_cache >= IPXPORT_WELLKNOWN))
ipxpcb_lport_cache = IPXPORT_RESERVED;
lport = htons(ipxpcb_lport_cache);
} while (ipx_pcblookup(&zeroipx_addr, lport, 0));
ipxp->ipxp_lport = lport;
return (0);