mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-02 20:12:48 -05:00
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]
This commit is contained in:
@ -24,9 +24,6 @@ struct FontSpec *fontspec_new(const char *name);
|
||||
|
||||
typedef void *Context; /* FIXME: probably needs changing */
|
||||
|
||||
typedef int OSSocket;
|
||||
#define OSSOCKET_DEFINED /* stop network.h using its default */
|
||||
|
||||
extern Backend pty_backend;
|
||||
|
||||
typedef uint32_t uint32; /* C99: uint32_t defined in stdint.h */
|
||||
|
Reference in New Issue
Block a user