Date: Sun, 23 Mar 2003 11:29:24 -0500 (EST) From: David A Jenkins Subject: Patch submission Folks, A while ago I posted a patch to 3.14 to enable bandwidth limits per-connection. The bandwidth limit was hard-coded to 200 kbps, but with overhead it was always something less than that. I've ported the same patch to 4.04. The bandwidth limit is still per-connection and still hard-coded. The patch is attached. I could make this patch more polished, but I don't think people usually want their stunnel to run slower, so I doubt anyone is using this patch. Why am I using it? Let's say I have a small dial-up service with a small news server. Then I decide to allow people to access the news server from the (much faster) internet backbone. I use this patch to slow down news readers to the point where they seem like dial-up news readers, and then I don't have to buy a new news server. How does it work? Since stunnel has a thread for each connection, all we have to do is have the thread nanosleep the right amount of time after each write. The amount of time to sleep is a function of the number of bytes written. The table of sleep times is computed only once. Build Notes: You also have to change line 125 of src/Makefile to include -lposix4. Since that is a generated file, I can't patch it, and I'm too lazy to add this to configure correctly. Dave