mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 09:27:59 +00: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 (commit7b0e08270
), 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 (commit42334b65b
). 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:
parent
5e2ac205fd
commit
9545199ea5
@ -50,7 +50,6 @@ static const SocketVtable ErrorSocket_sockvt = {
|
||||
NULL /* write */,
|
||||
NULL /* write_oob */,
|
||||
NULL /* write_eof */,
|
||||
NULL /* flush */,
|
||||
NULL /* set_frozen */,
|
||||
sk_error_socket_error,
|
||||
sk_error_peer_info,
|
||||
|
@ -31,7 +31,6 @@ struct SocketVtable {
|
||||
size_t (*write) (Socket *s, const void *data, size_t len);
|
||||
size_t (*write_oob) (Socket *s, const void *data, size_t len);
|
||||
void (*write_eof) (Socket *s);
|
||||
void (*flush) (Socket *s);
|
||||
void (*set_frozen) (Socket *s, bool is_frozen);
|
||||
/* ignored by tcp, but vital for ssl */
|
||||
const char *(*socket_error) (Socket *s);
|
||||
@ -158,8 +157,6 @@ static inline size_t sk_write_oob(Socket *s, const void *data, size_t len)
|
||||
{ return s->vt->write_oob(s, data, len); }
|
||||
static inline void sk_write_eof(Socket *s)
|
||||
{ s->vt->write_eof(s); }
|
||||
static inline void sk_flush(Socket *s)
|
||||
{ s->vt->flush(s); }
|
||||
|
||||
static inline void plug_log(
|
||||
Plug *p, int type, SockAddr *addr, int port, const char *msg, int code)
|
||||
|
18
proxy.c
18
proxy.c
@ -57,11 +57,6 @@ void proxy_activate (ProxySocket *p)
|
||||
if (output_after < output_before)
|
||||
plug_sent(p->plug, output_after);
|
||||
|
||||
/* if we were asked to flush the output during
|
||||
* the proxy negotiation process, do so now.
|
||||
*/
|
||||
if (p->pending_flush) sk_flush(p->sub_socket);
|
||||
|
||||
/* if we have a pending EOF to send, send it */
|
||||
if (p->pending_eof) sk_write_eof(p->sub_socket);
|
||||
|
||||
@ -128,17 +123,6 @@ static void sk_proxy_write_eof (Socket *s)
|
||||
sk_write_eof(ps->sub_socket);
|
||||
}
|
||||
|
||||
static void sk_proxy_flush (Socket *s)
|
||||
{
|
||||
ProxySocket *ps = container_of(s, ProxySocket, sock);
|
||||
|
||||
if (ps->state != PROXY_STATE_ACTIVE) {
|
||||
ps->pending_flush = true;
|
||||
return;
|
||||
}
|
||||
sk_flush(ps->sub_socket);
|
||||
}
|
||||
|
||||
static void sk_proxy_set_frozen (Socket *s, bool is_frozen)
|
||||
{
|
||||
ProxySocket *ps = container_of(s, ProxySocket, sock);
|
||||
@ -393,7 +377,6 @@ static const struct SocketVtable ProxySocket_sockvt = {
|
||||
sk_proxy_write,
|
||||
sk_proxy_write_oob,
|
||||
sk_proxy_write_eof,
|
||||
sk_proxy_flush,
|
||||
sk_proxy_set_frozen,
|
||||
sk_proxy_socket_error,
|
||||
NULL, /* peer_info */
|
||||
@ -437,7 +420,6 @@ Socket *new_connection(SockAddr *addr, const char *hostname,
|
||||
ret->remote_port = port;
|
||||
|
||||
ret->error = NULL;
|
||||
ret->pending_flush = false;
|
||||
ret->pending_eof = false;
|
||||
ret->freeze = false;
|
||||
|
||||
|
@ -229,12 +229,6 @@ static void fdsocket_write_eof(Socket *s)
|
||||
fdsocket_try_send(fds);
|
||||
}
|
||||
|
||||
static void fdsocket_flush(Socket *s)
|
||||
{
|
||||
/* FdSocket *fds = container_of(s, FdSocket, sock); */
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
static void fdsocket_set_frozen(Socket *s, bool is_frozen)
|
||||
{
|
||||
FdSocket *fds = container_of(s, FdSocket, sock);
|
||||
@ -315,7 +309,6 @@ static const SocketVtable FdSocket_sockvt = {
|
||||
fdsocket_write,
|
||||
fdsocket_write_oob,
|
||||
fdsocket_write_eof,
|
||||
fdsocket_flush,
|
||||
fdsocket_set_frozen,
|
||||
fdsocket_socket_error,
|
||||
NULL, /* peer_info */
|
||||
|
@ -492,14 +492,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);
|
||||
@ -514,7 +506,6 @@ static struct 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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user