ripout.c

来自「TCP-IP红宝书源代码」· C语言 代码 · 共 35 行

C
35 行
字号
/* ripout.c - ripout */

#include <conf.h>
#include <kernel.h>
#include <network.h>
#include <sleep.h>
#include <proc.h>

#ifdef	RIP
/*------------------------------------------------------------------------
 *  ripout  -  do the RIP route exchange protocol, output side
 *------------------------------------------------------------------------
 */
PROCESS
ripout(void)
{
	int	rnd;

	rippid = getpid();
	dorip = TRUE;
	/* advertise our routes */

	rnd = 0;	/* "randomizer" */
	while (TRUE) {
		sleep10(RIPOUTMIN);	/* minimum time between each	*/
		if (++rnd > RIPDELTA)
			rnd = -RIPDELTA;
		recvtim(RIPINT-RIPOUTMIN+rnd);
		wait(riplock);
		ripsend(ip_maskall, UP_RIP);
		signal(riplock);
	}
}
#endif	/* RIP */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?