1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 11:32:48 -05:00

Completely remove sk_flush().

I've only just noticed that it doesn't do anything at all!

Almost every implementation of the Socket vtable provides a flush()
method which does nothing, optionally with a comment explaining why
it's OK to do nothing. The sole exception is the wrapper Proxy_Socket,
which implements the method during its setup phase by setting a
pending_flush flag, so that when its sub-socket is later created, it
can call sk_flush on that. But since the sub-socket's sk_flush will do
nothing, even that is completely pointless!

Source control history says that sk_flush was introduced by Dave
Hinton in 2001 (commit 7b0e08270), who was going to use it for some
purpose involving the SSL Telnet support he was working on at the
time. That SSL support was never finished, and its vestigial
declarations in network.h were removed in 2015 (commit 42334b65b). So
sk_flush is just another vestige of that abandoned work, which I
should have removed in the latter commit but overlooked.
This commit is contained in:
Simon Tatham
2019-07-28 10:32:17 +01:00
parent 5e2ac205fd
commit 9545199ea5
8 changed files with 1 additions and 56 deletions

View File

@ -156,12 +156,6 @@ static void sk_handle_write_eof(Socket *s)
handle_write_eof(hs->send_h);
}
static void sk_handle_flush(Socket *s)
{
/* HandleSocket *hs = container_of(s, HandleSocket, sock); */
/* do nothing */
}
static void handle_socket_unfreeze(void *hsv)
{
HandleSocket *hs = (HandleSocket *)hsv;
@ -315,7 +309,6 @@ static const SocketVtable HandleSocket_sockvt = {
sk_handle_write,
sk_handle_write_oob,
sk_handle_write_eof,
sk_handle_flush,
sk_handle_set_frozen,
sk_handle_socket_error,
sk_handle_peer_info,

View File

@ -823,14 +823,6 @@ static Plug *sk_net_plug(Socket *sock, Plug *p)
return ret;
}
static void sk_net_flush(Socket *s)
{
/*
* We send data to the socket as soon as we can anyway,
* so we don't need to do anything here. :-)
*/
}
static void sk_net_close(Socket *s);
static size_t sk_net_write(Socket *s, const void *data, size_t len);
static size_t sk_net_write_oob(Socket *s, const void *data, size_t len);
@ -845,7 +837,6 @@ static const SocketVtable NetSocket_sockvt = {
sk_net_write,
sk_net_write_oob,
sk_net_write_eof,
sk_net_flush,
sk_net_set_frozen,
sk_net_socket_error,
sk_net_peer_info,

View File

@ -192,7 +192,7 @@ static void named_pipe_connect_callback(void *vps)
/*
* This socket type is only used for listening, so it should never
* be asked to write or flush or set_frozen.
* be asked to write or set_frozen.
*/
static const SocketVtable NamedPipeServerSocket_sockvt = {
sk_namedpipeserver_plug,
@ -200,7 +200,6 @@ static const SocketVtable NamedPipeServerSocket_sockvt = {
NULL /* write */,
NULL /* write_oob */,
NULL /* write_eof */,
NULL /* flush */,
NULL /* set_frozen */,
sk_namedpipeserver_socket_error,
sk_namedpipeserver_peer_info,