On Tue, Feb 16, 2016 at 9:30 AM, Sebastian Lackner <sebastian@fds-team.de> wrote:
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
---

@Bruno: As far as I remember you were working on a fix for this, what is the progress?

Hi, Sebastian. Unfortunately since December I'm buried by real life work and I thought I could restart working in Wine on February but that was not possible.

My solution to this is still theoretical, I didn't write any code yet. The solution is to cache the values of SO_RCVBUF, SO_SNDBU, SO_REUSEADDR and SO_ACCEPTCONN. Why?

SO_RCVBUF and SO_SNBUF are messed by Linux kernel. So we would cache the requested value and return a min() between what we have in the cache and what we read back from the kernel. This would solve this problem and not require #ifdef.

SO_REUSEADDR because Windows does not have TIME_WAIT at all, so all sockets would be created with SO_REUSEADDR in the server and we would take care of it manually. There is a long standing uTorrent bug about this.

SO_ACCEPTCONN is bugged in OSX, it is never updated by the kernel so it is useless and always fail. To solve this we would set the cache to 1 when listen() is called and return the cache instead of asking for the kernel.

I'm still reading all bugs and emails so I'm aware of your divide by 2 solution and I really don't mind if it gets accepted as it is ready and mine is still months to come.

Best wishes,
Bruno