TCP-group 1994
[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
RTT Storage
- To: tcp-group@ucsd.edu
- Subject: RTT Storage
- From: samst@bdol10.indepth.com (Steve Sampson)
- Date: Mon, 19 Dec 1994 15:11:07 -0600 (CST)
- Cc: k5jb@k5jb.org
one area that might be an improvement is the storage of the smoothed
round trip time in a temporary file. Every time you shut the NOS down
you have to start over again. In JNOS the rtt cache has up to 16 entries,
and can be readily stored in a file during shutdown. Then during reboot,
they can be scooped in again and your system timing is something better than
the defaults. Limited testing so far, and may need macro defines for other
Operating Sytems that I didn't look into fully - such as "rb" for file open...
In main.c:
kinit();
ipinit();
ioinit();
> rtt_read(); /* read the tcp smoothed round trip time cache file */
Cmdpp = mainproc("cmdintrp");
and
void
where_outta_here(resetme)
int resetme;
{
time_t StopTime;
FILE *fp;
char *inbuf,*intmp;
> rtt_store(); /* Write the tcp round trip times to cache file */
Then in files.c:
/* So NET and NOS can coexist in \net, I will try ftpusers.nos but if it
* doesn't exist, we will lop off the .nos. K5JB */
char *Userfile = "/ftpusers.nos"; /* Authorized FTP users and passwords */
#else
char *Userfile = "/ftpusers"; /* Authorized FTP users and passwords */
#endif
> char *Rttfile = "/rttcache"; /* tcp round trip time cache store */
char *Hostfile = "/net.rc"; /* hosts and passwords */
char *Spoolqdir = "/spool"; /* Spool directory */
and
Hostfile = rootdircat(Hostfile);
> Rttfile = rootdircat(Rttfile);
#ifdef SMTPLOG
Maillog = rootdircat(Maillog);
#endif
Spoolqdir = rootdircat(Spoolqdir);
And the main change in tcpsubr.c:
struct tcp_rtt *
rtt_get(addr)
int32 addr;
{
register struct tcp_rtt *tp;
if(addr == 0)
return NULLRTT;
tp = &Tcp_rtt[(unsigned short)addr % RTTCACHE];
if(tp->addr != addr)
return NULLRTT;
return tp;
}
> void
> rtt_store(void)
> {
> extern char *Rttfile;
> FILE *stream;
> struct tcp_rtt *tp;
> int val;
>
> if ((stream = fopen(Rttfile, "wb")) == NULL)
> return;
>
> for (tp = &Tcp_rtt[0]; tp < &Tcp_rtt[RTTCACHE]; tp++) {
> if (tp->addr != 0) {
> val = fwrite((void *)tp, sizeof(struct tcp_rtt), 1, stream);
> if (val != 1)
> break;
> }
> }
>
> fclose(stream);
> }
>
> void
> rtt_read(void)
> {
> extern char *Rttfile;
> FILE *stream;
> struct tcp_rtt *tp;
> int val;
>
> if ((stream = fopen(Rttfile, "rb")) == NULL)
> return;
>
> for (tp = &Tcp_rtt[0]; tp < &Tcp_rtt[RTTCACHE]; tp++) {
> val = fread((void *)tp, sizeof(struct tcp_rtt), 1, stream);
> if (val != 1)
> break;
> }
>
> fclose(stream);
> }
>
----
That's about it.
--
n5owk