ports/www/http_load/files/patch-aa
Mike Silbersack 701c047431 Add a patch to the port which improves the -throttle option by
shrinking the receive socket buffer size to 2K.

The patch has been submitted to http_load's author for possible
inclusion in future versions of http_load.
2003-12-14 05:17:54 +00:00

27 lines
720 B
Text

--- http_load.c.old Tue Dec 9 02:22:07 2003
+++ http_load.c Tue Dec 9 03:43:39 2003
@@ -825,6 +825,7 @@
ClientData client_data;
int flags;
int sip_num;
+ int rcv_bytes, error;
/* Start filling in the connection slot. */
connections[cnum].url_num = url_num;
@@ -863,6 +864,16 @@
perror( urls[url_num].url_str );
(void) close( connections[cnum].conn_fd );
return;
+ }
+
+ /* Shrink the recieve window to better imitate a slow connection. */
+ if ( do_throttle )
+ {
+ rcv_bytes = 2048;
+ error = setsockopt(connections[cnum].conn_fd, SOL_SOCKET, SO_RCVBUF,
+ (void *)&rcv_bytes, sizeof(rcv_bytes));
+ if (error)
+ perror("Setsockopt problem:");
}
if ( num_sips > 0 )