]> asedeno.scripts.mit.edu Git - PuTTY.git/commit - windows/winnet.c
Replace the hacky 'OSSocket' type with a closure.
authorSimon Tatham <anakin@pobox.com>
Sun, 17 Nov 2013 14:03:55 +0000 (14:03 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 17 Nov 2013 14:03:55 +0000 (14:03 +0000)
commit19fba3fe550785b2584264a59d3dccea81077451
tree14749f78a48bb99c6ca511aa1a00642b82e96901
parent9093071faaddeb52428d6f1f3afccb1ac4d9ad48
Replace the hacky 'OSSocket' type with a closure.

The mechanism for constructing a new connection-type Socket when a
listening one receives an incoming connection previously worked by
passing a platform-specific 'OSSocket' type to the plug_accepting
function, which would then call sk_register to wrap it with a proper
Socket instance. This is less flexible than ideal, because it presumes
that only one kind of OS object might ever need to be turned into a
Socket. So I've replaced OSSocket throughout the code base with a pair
of parameters consisting of a function pointer and a context such that
passing the latter to the former returns the appropriate Socket; this
will permit different classes of listening Socket to pass different
function pointers.

In deference to the reality that OSSockets tend to be small integers
or pointer-sized OS handles, I've made the context parameter an
int/pointer union that can hold either of those directly, rather than
the usual approach of making it a plain 'void *' and requiring a
context structure to be dynamically allocated every time.

[originally from svn r10068]
network.h
portfwd.c
proxy.c
proxy.h
unix/unix.h
unix/uxnet.c
windows/winnet.c
x11fwd.c