1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00
putty-source/unix
Simon Tatham ca70b1285d Allow creating FdSocket/HandleSocket before the fds/handles.
Previously, a setup function returning one of these socket types (such
as platform_new_connection) had to do all its setup synchronously,
because if it was going to call make_fd_socket or make_handle_socket,
it had to have the actual fds or HANDLEs ready-made. If some kind of
asynchronous operation were needed before those fds become available,
there would be no way the function could achieve it, except by
becoming a whole extra permanent Socket wrapper layer.

Now there is, because you can make an FdSocket when you don't yet have
the fds, or a HandleSocket without the HANDLEs. Instead, you provide
an instance of the new trait 'DeferredSocketOpener', which is
responsible for setting in motion whatever asynchronous setup
procedure it needs, and when that finishes, calling back to
setup_fd_socket / setup_handle_socket to provide the missing pieces.

In the meantime, the FdSocket or HandleSocket will sit there inertly,
buffering any data the client might eagerly hand it via sk_write(),
and waiting for its setup to finish. When it does finish, buffered
data will be released.

In FdSocket, this is easy enough, because we were doing our own
buffering anyway - we called the uxsel system to find out when the fds
were readable/writable, and then wrote to them from our own bufchain.
So more or less all I had to do was make the try_send function do
nothing if the setup phase wasn't finished yet.

In HandleSocket, on the other hand, we're passing all our data to the
underlying handle-io.c system, and making _that_ deferrable in the
same way would be much more painful, because that's the place where
the scary threads live. So instead I've arranged it by replacing the
whole vtable, so that a deferred HandleSocket and a normal
HandleSocket are effectively separate trait implementations that can
share their state structure. And in fact that state struct itself now
contains a big anonymous union, containing one branch to go with each
vtable.

Nothing yet uses this system, but the next commit will do so.
2021-12-22 15:45:41 +00:00
..
utils Break up gtkmisc.c. 2021-04-26 18:00:01 +01:00
agent-client.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
agent-socket.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
askpass.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
cliloop.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
CMakeLists.txt Fix pre-GTK3 build failures in puttyapp / ptermapp. 2021-12-18 11:43:57 +00:00
columns.c GTK: allow Event Log list box to grow vertically. 2021-12-21 10:53:41 +00:00
columns.h GTK: allow Event Log list box to grow vertically. 2021-12-21 10:53:41 +00:00
config-gtk.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
config-unix.c Initial support for in-process proxy SSH connections. 2021-05-22 14:13:52 +01:00
console.c New Seat query, has_mixed_input_stream(). 2021-11-06 14:48:26 +00:00
dialog.c GTK: allow Event Log list box to grow vertically. 2021-12-21 10:53:41 +00:00
fd-socket.c Allow creating FdSocket/HandleSocket before the fds/handles. 2021-12-22 15:45:41 +00:00
gss.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
gtk-common.c GTK: run toplevel callbacks when an fd is active. 2021-12-20 13:11:48 +00:00
gtkcompat.h gtkcompat.h: fix GTK1 implementation of ref_sink. 2019-11-02 08:26:14 +00:00
gtkmisc.h Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
keygen-noise.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
local-proxy.c Pass an Interactor to platform_new_connection. 2021-12-22 15:24:58 +00:00
main-gtk-application.c Fix pre-GTK3 build failures in puttyapp / ptermapp. 2021-12-18 11:43:57 +00:00
main-gtk-simple.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
network.c Generalise strbuf_catf() into put_fmt(). 2021-11-19 11:32:47 +00:00
no-gtk.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
noise.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
osxlaunch.c osxlaunch: stop setting DYLD_LIBRARY_PATH. 2017-12-20 10:04:02 +00:00
pageant.c Merge be_*.c into one ifdef-controlled module. 2021-11-26 17:58:55 +00:00
peerinfo.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
platform.h Allow creating FdSocket/HandleSocket before the fds/handles. 2021-12-22 15:45:41 +00:00
plink.c Marshalling macros put_dataz and put_datalit. 2021-11-19 15:09:17 +00:00
printing.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
procnet.c Generalise strbuf_catf() into put_fmt(). 2021-11-19 11:32:47 +00:00
psocks.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
psusan.c Merge be_*.c into one ifdef-controlled module. 2021-11-26 17:58:55 +00:00
pterm-config-xpm.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
pterm-xpm.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
pterm.bundle OS X makefile: stop depending on JHBUILD_PREFIX. 2017-11-26 11:45:48 +00:00
pterm.c Merge be_*.c into one ifdef-controlled module. 2021-11-26 17:58:55 +00:00
pterm.plist Whitespace rationalisation of entire code base. 2019-09-08 20:29:21 +01:00
pty.c Proper backlog handling in Unix pty backend. 2021-12-20 13:14:40 +00:00
putty-config-xpm.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
putty-xpm.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
putty.bundle OS X makefile: stop depending on JHBUILD_PREFIX. 2017-11-26 11:45:48 +00:00
putty.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
putty.plist Whitespace rationalisation of entire code base. 2019-09-08 20:29:21 +01:00
serial.c Add memsets after allocation of all Backend implementors. 2021-10-30 17:28:28 +01:00
sftp.c Complete rework of terminal userpass input system. 2021-09-14 13:19:33 +01:00
sftpserver.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
sharing.c Pass an Interactor to new_connection(). 2021-10-30 18:19:56 +01:00
storage.c Marshalling macros put_dataz and put_datalit. 2021-11-19 15:09:17 +00:00
unicode.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
unifont.c Generalise strbuf_catf() into put_fmt(). 2021-11-19 11:32:47 +00:00
unifont.h Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
uppity.c Merge be_*.c into one ifdef-controlled module. 2021-11-26 17:58:55 +00:00
uxsel.c Whitespace rationalisation of entire code base. 2019-09-08 20:29:21 +01:00
window.c GTK: stop using geometry hints when not on X11. 2021-12-20 13:30:25 +00:00
x11.c Unix platform_make_x11_server: fix sense of error check. 2021-09-10 10:38:30 +01:00
x11misc.h Basic support for running under GDK Wayland back end. 2018-05-09 09:21:27 +01:00