Implement (optional, compile-time) shrinking of send buffer for torture tests.

This commit is contained in:
Emil Mikulic 2006-12-13 07:35:29 +00:00
parent 94d3403c2e
commit ab1204f700
1 changed files with 10 additions and 0 deletions

View File

@ -866,6 +866,16 @@ static void init_sockin(void)
&sockopt, sizeof(sockopt)) == -1)
err(1, "setsockopt(SO_REUSEADDR)");
#ifdef TORTURE
/* torture: cripple the kernel-side send buffer so we can only squeeze out
* one byte at a time (this is for debugging)
*/
sockopt = 1;
if (setsockopt(sockin, SOL_SOCKET, SO_SNDBUF,
&sockopt, sizeof(sockopt)) == -1)
err(1, "setsockopt(SO_SNDBUF)");
#endif
/* bind socket */
addrin.sin_family = (u_char)PF_INET;
addrin.sin_port = htons(bindport);