1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Remove 'calling_back' parameter from plug_closing.

It was totally unused. No implementation of the 'closing' method in a
Plug vtable was checking it for any reason at all, except for
ProxySocket which captured it from its client in order to pass on to
its server (which, perhaps after further iterations of ProxySocket,
would have ended up ignoring it similarly). And every caller of
plug_closing set it to 0 (aka false), except for the one in sshproxy.c
which passed true (but it would have made no difference to anyone).

The comment in network.h refers to a FIXME comment which was in
try_send() when that code was written (see winnet.c in commit
7b0e082700). That FIXME is long gone, replaced by a use of a
toplevel callback. So I think the aim must have been to avoid
re-entrancy when sk_write called try_send which encountered a socket
error and called back to plug_closing - but that's long since fixed by
other means now.
This commit is contained in:
Simon Tatham 2021-10-23 17:54:21 +01:00
parent b13f3d079b
commit d42f1fe96d
26 changed files with 76 additions and 101 deletions

View File

@ -67,13 +67,13 @@ int proxy_socks5_handlechap (ProxySocket *p)
if (data[0] != 0x01) {
plug_closing(p->plug, "Proxy error: SOCKS proxy wants"
" a different CHAP version",
PROXY_ERROR_GENERAL, 0);
PROXY_ERROR_GENERAL);
return 1;
}
if (data[1] == 0x00) {
plug_closing(p->plug, "Proxy error: SOCKS proxy won't"
" negotiate CHAP with us",
PROXY_ERROR_GENERAL, 0);
PROXY_ERROR_GENERAL);
return 1;
}
p->chap_num_attributes = data[1];
@ -105,7 +105,7 @@ int proxy_socks5_handlechap (ProxySocket *p)
else {
plug_closing(p->plug, "Proxy error: SOCKS proxy"
" refused CHAP authentication",
PROXY_ERROR_GENERAL, 0);
PROXY_ERROR_GENERAL);
return 1;
}
break;
@ -125,7 +125,7 @@ int proxy_socks5_handlechap (ProxySocket *p)
plug_closing(p->plug, "Proxy error: Server chose "
"CHAP of other than HMAC-MD5 but we "
"didn't offer it!",
PROXY_ERROR_GENERAL, 0);
PROXY_ERROR_GENERAL);
return 1;
}
break;
@ -174,6 +174,6 @@ int proxy_socks5_selectchap(ProxySocket *p)
} else
plug_closing(p->plug, "Proxy error: Server chose "
"CHAP authentication but we didn't offer it!",
PROXY_ERROR_GENERAL, 0);
PROXY_ERROR_GENERAL);
return 1;
}

View File

@ -87,7 +87,7 @@ struct PlugVtable {
* the logged events.
*/
void (*closing)
(Plug *p, const char *error_msg, int error_code, bool calling_back);
(Plug *p, const char *error_msg, int error_code);
/* error_msg is NULL iff it is not an error (ie it closed normally) */
/* calling_back != 0 iff there is a Plug function */
/* currently running (would cure the fixme in try_send()) */
@ -214,9 +214,8 @@ static inline void sk_write_eof(Socket *s)
static inline void plug_log(
Plug *p, int type, SockAddr *addr, int port, const char *msg, int code)
{ p->vt->log(p, type, addr, port, msg, code); }
static inline void plug_closing(
Plug *p, const char *msg, int code, bool calling_back)
{ p->vt->closing(p, msg, code, calling_back); }
static inline void plug_closing(Plug *p, const char *msg, int code)
{ p->vt->closing(p, msg, code); }
static inline void plug_receive(Plug *p, int urg, const char *data, size_t len)
{ p->vt->receive(p, urg, data, len); }
static inline void plug_sent (Plug *p, size_t bufsize)
@ -341,8 +340,7 @@ extern Plug *const nullplug;
*/
void nullplug_log(Plug *plug, PlugLogType type, SockAddr *addr,
int port, const char *err_msg, int err_code);
void nullplug_closing(Plug *plug, const char *error_msg, int error_code,
bool calling_back);
void nullplug_closing(Plug *plug, const char *error_msg, int error_code);
void nullplug_receive(Plug *plug, int urgent, const char *data, size_t len);
void nullplug_sent(Plug *plug, size_t bufsize);

View File

@ -22,7 +22,7 @@ int proxy_socks5_handlechap (ProxySocket *p)
plug_closing(p->plug, "Proxy error: Trying to handle a SOCKS5 CHAP request"
" in telnet-only build",
PROXY_ERROR_GENERAL, 0);
PROXY_ERROR_GENERAL);
return 1;
}
@ -30,6 +30,6 @@ int proxy_socks5_selectchap(ProxySocket *p)
{
plug_closing(p->plug, "Proxy error: Trying to handle a SOCKS5 CHAP request"
" in telnet-only build",
PROXY_ERROR_GENERAL, 0);
PROXY_ERROR_GENERAL);
return 1;
}

View File

@ -12,8 +12,7 @@ void nullplug_log(Plug *plug, PlugLogType type, SockAddr *addr,
{
}
void nullplug_closing(Plug *plug, const char *error_msg, int error_code,
bool calling_back)
void nullplug_closing(Plug *plug, const char *error_msg, int error_code)
{
}

View File

@ -69,8 +69,7 @@ static void raw_check_close(Raw *raw)
}
}
static void raw_closing(Plug *plug, const char *error_msg, int error_code,
bool calling_back)
static void raw_closing(Plug *plug, const char *error_msg, int error_code)
{
Raw *raw = container_of(plug, Raw, plug);

View File

@ -89,8 +89,7 @@ static void rlogin_log(Plug *plug, PlugLogType type, SockAddr *addr, int port,
}
}
static void rlogin_closing(Plug *plug, const char *error_msg, int error_code,
bool calling_back)
static void rlogin_closing(Plug *plug, const char *error_msg, int error_code)
{
Rlogin *rlogin = container_of(plug, Rlogin, plug);

View File

@ -577,8 +577,7 @@ static void supdup_log(Plug *plug, PlugLogType type, SockAddr *addr, int port,
}
}
static void supdup_closing(Plug *plug, const char *error_msg, int error_code,
bool calling_back)
static void supdup_closing(Plug *plug, const char *error_msg, int error_code)
{
Supdup *supdup = container_of(plug, Supdup, plug);

View File

@ -639,8 +639,7 @@ static void telnet_log(Plug *plug, PlugLogType type, SockAddr *addr, int port,
}
}
static void telnet_closing(Plug *plug, const char *error_msg, int error_code,
bool calling_back)
static void telnet_closing(Plug *plug, const char *error_msg, int error_code)
{
Telnet *telnet = container_of(plug, Telnet, plug);

View File

@ -1464,7 +1464,7 @@ struct pageant_conn_state {
};
static void pageant_conn_closing(Plug *plug, const char *error_msg,
int error_code, bool calling_back)
int error_code)
{
struct pageant_conn_state *pc = container_of(
plug, struct pageant_conn_state, plug);
@ -1611,7 +1611,7 @@ struct pageant_listen_state {
};
static void pageant_listen_closing(Plug *plug, const char *error_msg,
int error_code, bool calling_back)
int error_code)
{
struct pageant_listen_state *pl = container_of(
plug, struct pageant_listen_state, plug);

56
proxy.c
View File

@ -181,18 +181,16 @@ static void plug_proxy_log(Plug *plug, PlugLogType type, SockAddr *addr,
plug_log(ps->plug, type, addr, port, error_msg, error_code);
}
static void plug_proxy_closing (Plug *p, const char *error_msg,
int error_code, bool calling_back)
static void plug_proxy_closing(Plug *p, const char *error_msg, int error_code)
{
ProxySocket *ps = container_of(p, ProxySocket, plugimpl);
if (ps->state != PROXY_STATE_ACTIVE) {
ps->closing_error_msg = error_msg;
ps->closing_error_code = error_code;
ps->closing_calling_back = calling_back;
ps->negotiate(ps, PROXY_CHANGE_CLOSING);
} else {
plug_closing(ps->plug, error_msg, error_code, calling_back);
plug_closing(ps->plug, error_msg, error_code);
}
}
@ -617,8 +615,7 @@ int proxy_http_negotiate (ProxySocket *p, int change)
* a socket close, then some error must have occurred. we'll
* just pass those errors up to the backend.
*/
plug_closing(p->plug, p->closing_error_msg, p->closing_error_code,
p->closing_calling_back);
plug_closing(p->plug, p->closing_error_msg, p->closing_error_code);
return 0; /* ignored */
}
@ -675,7 +672,7 @@ int proxy_http_negotiate (ProxySocket *p, int change)
if (sscanf((char *)data, "HTTP/%i.%i %n",
&maj_ver, &min_ver, &status) < 2 || status == -1) {
plug_closing(p->plug, "Proxy error: HTTP response was absent",
PROXY_ERROR_GENERAL, 0);
PROXY_ERROR_GENERAL);
sfree(data);
return 1;
}
@ -690,7 +687,7 @@ int proxy_http_negotiate (ProxySocket *p, int change)
(data[eol-1] == '\r' || data[eol-1] == '\n'))
data[--eol] = '\0';
buf = dupprintf("Proxy error: %s", data+status);
plug_closing(p->plug, buf, PROXY_ERROR_GENERAL, 0);
plug_closing(p->plug, buf, PROXY_ERROR_GENERAL);
sfree(buf);
sfree(data);
return 1;
@ -741,7 +738,7 @@ int proxy_http_negotiate (ProxySocket *p, int change)
}
plug_closing(p->plug, "Proxy error: unexpected proxy error",
PROXY_ERROR_UNEXPECTED, 0);
PROXY_ERROR_UNEXPECTED);
return 1;
}
@ -807,8 +804,7 @@ int proxy_socks4_negotiate (ProxySocket *p, int change)
* a socket close, then some error must have occurred. we'll
* just pass those errors up to the backend.
*/
plug_closing(p->plug, p->closing_error_msg, p->closing_error_code,
p->closing_calling_back);
plug_closing(p->plug, p->closing_error_msg, p->closing_error_code);
return 0; /* ignored */
}
@ -860,7 +856,7 @@ int proxy_socks4_negotiate (ProxySocket *p, int change)
if (data[0] != 0) {
plug_closing(p->plug, "Proxy error: SOCKS proxy responded with "
"unexpected reply code version",
PROXY_ERROR_GENERAL, 0);
PROXY_ERROR_GENERAL);
return 1;
}
@ -869,16 +865,16 @@ int proxy_socks4_negotiate (ProxySocket *p, int change)
switch (data[1]) {
case 92:
plug_closing(p->plug, "Proxy error: SOCKS server wanted IDENTD on client",
PROXY_ERROR_GENERAL, 0);
PROXY_ERROR_GENERAL);
break;
case 93:
plug_closing(p->plug, "Proxy error: Username and IDENTD on client don't agree",
PROXY_ERROR_GENERAL, 0);
PROXY_ERROR_GENERAL);
break;
case 91:
default:
plug_closing(p->plug, "Proxy error: Error while communicating with proxy",
PROXY_ERROR_GENERAL, 0);
PROXY_ERROR_GENERAL);
break;
}
@ -895,7 +891,7 @@ int proxy_socks4_negotiate (ProxySocket *p, int change)
}
plug_closing(p->plug, "Proxy error: unexpected proxy error",
PROXY_ERROR_UNEXPECTED, 0);
PROXY_ERROR_UNEXPECTED);
return 1;
}
@ -951,8 +947,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change)
* a socket close, then some error must have occurred. we'll
* just pass those errors up to the backend.
*/
plug_closing(p->plug, p->closing_error_msg, p->closing_error_code,
p->closing_calling_back);
plug_closing(p->plug, p->closing_error_msg, p->closing_error_code);
return 0; /* ignored */
}
@ -1002,7 +997,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change)
if (data[0] != 5) {
plug_closing(p->plug, "Proxy error: SOCKS proxy returned unexpected version",
PROXY_ERROR_GENERAL, 0);
PROXY_ERROR_GENERAL);
return 1;
}
@ -1012,7 +1007,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change)
else if (data[1] == 0x03) p->state = 6; /* CHAP authentication */
else {
plug_closing(p->plug, "Proxy error: SOCKS proxy did not accept our authentication",
PROXY_ERROR_GENERAL, 0);
PROXY_ERROR_GENERAL);
return 1;
}
bufchain_consume(&p->pending_input_data, 2);
@ -1037,7 +1032,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change)
if (data[0] != 1) {
plug_closing(p->plug, "Proxy error: SOCKS password "
"subnegotiation contained wrong version number",
PROXY_ERROR_GENERAL, 0);
PROXY_ERROR_GENERAL);
return 1;
}
@ -1045,7 +1040,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change)
plug_closing(p->plug, "Proxy error: SOCKS proxy refused"
" password authentication",
PROXY_ERROR_GENERAL, 0);
PROXY_ERROR_GENERAL);
return 1;
}
@ -1148,7 +1143,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change)
if (data[0] != 5) {
plug_closing(p->plug, "Proxy error: SOCKS proxy returned wrong version number",
PROXY_ERROR_GENERAL, 0);
PROXY_ERROR_GENERAL);
return 1;
}
@ -1171,7 +1166,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change)
data[1]);
break;
}
plug_closing(p->plug, buf, PROXY_ERROR_GENERAL, 0);
plug_closing(p->plug, buf, PROXY_ERROR_GENERAL);
return 1;
}
@ -1187,7 +1182,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change)
default:
plug_closing(p->plug, "Proxy error: SOCKS proxy returned "
"unrecognised address format",
PROXY_ERROR_GENERAL, 0);
PROXY_ERROR_GENERAL);
return 1;
}
if (bufchain_size(&p->pending_input_data) < len)
@ -1202,7 +1197,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change)
if (p->state == 4) {
/* TODO: Handle GSSAPI authentication */
plug_closing(p->plug, "Proxy error: We don't support GSSAPI authentication",
PROXY_ERROR_GENERAL, 0);
PROXY_ERROR_GENERAL);
return 1;
}
@ -1231,7 +1226,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change)
plug_closing(p->plug, "Proxy error: Server chose "
"username/password authentication but we "
"didn't offer it!",
PROXY_ERROR_GENERAL, 0);
PROXY_ERROR_GENERAL);
return 1;
}
@ -1244,7 +1239,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change)
}
plug_closing(p->plug, "Proxy error: Unexpected proxy error",
PROXY_ERROR_UNEXPECTED, 0);
PROXY_ERROR_UNEXPECTED);
return 1;
}
@ -1479,8 +1474,7 @@ int proxy_telnet_negotiate (ProxySocket *p, int change)
* a socket close, then some error must have occurred. we'll
* just pass those errors up to the backend.
*/
plug_closing(p->plug, p->closing_error_msg, p->closing_error_code,
p->closing_calling_back);
plug_closing(p->plug, p->closing_error_msg, p->closing_error_code);
return 0; /* ignored */
}
@ -1516,6 +1510,6 @@ int proxy_telnet_negotiate (ProxySocket *p, int change)
}
plug_closing(p->plug, "Proxy error: Unexpected proxy error",
PROXY_ERROR_UNEXPECTED, 0);
PROXY_ERROR_UNEXPECTED);
return 1;
}

View File

@ -63,7 +63,6 @@ struct ProxySocket {
/* closing */
const char *closing_error_msg;
int closing_error_code;
bool closing_calling_back;
/* receive */
bool receive_urgent;

View File

@ -95,7 +95,7 @@ static const SshChannelVtable psocks_scvt = {
static void psocks_plug_log(Plug *p, PlugLogType type, SockAddr *addr,
int port, const char *error_msg, int error_code);
static void psocks_plug_closing(Plug *p, const char *error_msg,
int error_code, bool calling_back);
int error_code);
static void psocks_plug_receive(Plug *p, int urgent,
const char *data, size_t len);
static void psocks_plug_sent(Plug *p, size_t bufsize);
@ -355,7 +355,7 @@ static void psocks_plug_log(Plug *plug, PlugLogType type, SockAddr *addr,
}
static void psocks_plug_closing(Plug *plug, const char *error_msg,
int error_code, bool calling_back)
int error_code)
{
psocks_connection *conn = container_of(plug, psocks_connection, plug);
if (conn->connecting) {

View File

@ -109,8 +109,7 @@ static void pfl_log(Plug *plug, PlugLogType type, SockAddr *addr, int port,
static void pfd_close(struct PortForwarding *pf);
static void pfd_closing(Plug *plug, const char *error_msg, int error_code,
bool calling_back)
static void pfd_closing(Plug *plug, const char *error_msg, int error_code)
{
struct PortForwarding *pf =
container_of(plug, struct PortForwarding, plug);
@ -142,8 +141,7 @@ static void pfd_closing(Plug *plug, const char *error_msg, int error_code,
static void pfl_terminate(struct PortListener *pl);
static void pfl_closing(Plug *plug, const char *error_msg, int error_code,
bool calling_back)
static void pfl_closing(Plug *plug, const char *error_msg, int error_code)
{
struct PortListener *pl = (struct PortListener *) plug;
pfl_terminate(pl);

View File

@ -139,8 +139,7 @@ static void server_socket_log(Plug *plug, PlugLogType type, SockAddr *addr,
/* FIXME */
}
static void server_closing(Plug *plug, const char *error_msg, int error_code,
bool calling_back)
static void server_closing(Plug *plug, const char *error_msg, int error_code)
{
server *srv = container_of(plug, server, plug);
if (error_msg) {

View File

@ -366,8 +366,7 @@ bool sesschan_run_subsystem(Channel *chan, ptrlen subsys)
static void fwd_log(Plug *plug, PlugLogType type, SockAddr *addr, int port,
const char *error_msg, int error_code)
{ /* don't expect any weirdnesses from a listening socket */ }
static void fwd_closing(Plug *plug, const char *error_msg, int error_code,
bool calling_back)
static void fwd_closing(Plug *plug, const char *error_msg, int error_code)
{ /* not here, either */ }
static int xfwd_accepting(Plug *p, accept_fn_t constructor, accept_ctx_t ctx)

View File

@ -937,8 +937,7 @@ static void share_disconnect(struct ssh_sharing_connstate *cs,
share_begin_cleanup(cs);
}
static void share_closing(Plug *plug, const char *error_msg, int error_code,
bool calling_back)
static void share_closing(Plug *plug, const char *error_msg, int error_code)
{
struct ssh_sharing_connstate *cs = container_of(
plug, struct ssh_sharing_connstate, plug);
@ -1846,7 +1845,7 @@ static void share_sent(Plug *plug, size_t bufsize)
}
static void share_listen_closing(Plug *plug, const char *error_msg,
int error_code, bool calling_back)
int error_code)
{
ssh_sharing_state *sharestate =
container_of(plug, ssh_sharing_state, plug);

View File

@ -609,8 +609,7 @@ static void ssh_socket_log(Plug *plug, PlugLogType type, SockAddr *addr,
}
}
static void ssh_closing(Plug *plug, const char *error_msg, int error_code,
bool calling_back)
static void ssh_closing(Plug *plug, const char *error_msg, int error_code)
{
Ssh *ssh = container_of(plug, Ssh, plug);
if (error_msg) {

View File

@ -267,8 +267,7 @@ static void x11_log(Plug *p, PlugLogType type, SockAddr *addr, int port,
static void x11_send_init_error(struct X11Connection *conn,
const char *err_message);
static void x11_closing(Plug *plug, const char *error_msg, int error_code,
bool calling_back)
static void x11_closing(Plug *plug, const char *error_msg, int error_code)
{
struct X11Connection *xconn = container_of(
plug, struct X11Connection, plug);

View File

@ -244,7 +244,7 @@ static void try_send_ssh_to_socket(void *ctx)
if (sp->rcvd_eof_ssh_to_socket &&
!sp->sent_eof_ssh_to_socket) {
sp->sent_eof_ssh_to_socket = true;
plug_closing(sp->plug, sp->errmsg, 0, 0);
plug_closing(sp->plug, sp->errmsg, 0);
}
}
@ -325,7 +325,7 @@ static int sshproxy_get_userpass_input(Seat *seat, prompts_t *p)
static void sshproxy_connection_fatal_callback(void *vctx)
{
SshProxy *sp = (SshProxy *)vctx;
plug_closing(sp->plug, sp->errmsg, 0, true);
plug_closing(sp->plug, sp->errmsg, 0);
}
static void sshproxy_connection_fatal(Seat *seat, const char *message)

View File

@ -158,8 +158,7 @@ static void fdsocket_error_callback(void *vs)
/*
* An error has occurred on this socket. Pass it to the plug.
*/
plug_closing(fds->plug, strerror(fds->pending_error),
fds->pending_error, 0);
plug_closing(fds->plug, strerror(fds->pending_error), fds->pending_error);
}
static int fdsocket_try_send(FdSocket *fds)
@ -271,9 +270,9 @@ static void fdsocket_select_result_input(int fd, int event)
fds->infd = -1;
if (retd < 0) {
plug_closing(fds->plug, strerror(errno), errno, 0);
plug_closing(fds->plug, strerror(errno), errno);
} else {
plug_closing(fds->plug, NULL, 0, 0);
plug_closing(fds->plug, NULL, 0);
}
}
}

View File

@ -1101,7 +1101,7 @@ static void socket_error_callback(void *vs)
/*
* An error has occurred on this socket. Pass it to the plug.
*/
plug_closing(s->plug, strerror(s->pending_error), s->pending_error, 0);
plug_closing(s->plug, strerror(s->pending_error), s->pending_error);
}
/*
@ -1298,7 +1298,7 @@ static void net_select_result(int fd, int event)
if (ret <= 0) {
plug_closing(s->plug,
ret == 0 ? "Internal networking trouble" :
strerror(errno), errno, 0);
strerror(errno), errno);
} else {
/*
* Receiving actual data on a socket means we can
@ -1384,11 +1384,11 @@ static void net_select_result(int fd, int event)
}
}
if (ret < 0) {
plug_closing(s->plug, strerror(errno), errno, 0);
plug_closing(s->plug, strerror(errno), errno);
} else if (0 == ret) {
s->incomingeof = true; /* stop trying to read now */
uxsel_tell(s);
plug_closing(s->plug, NULL, 0, 0);
plug_closing(s->plug, NULL, 0);
} else {
/*
* Receiving actual data on a socket means we can
@ -1438,7 +1438,7 @@ static void net_select_result(int fd, int event)
err = try_connect(s);
}
if (err) {
plug_closing(s->plug, strerror(err), err, 0);
plug_closing(s->plug, strerror(err), err);
return; /* socket is now presumably defunct */
}
if (!s->connected)

View File

@ -249,8 +249,7 @@ static void x11_log(Plug *p, PlugLogType type, SockAddr *addr, int port,
const char *error_msg, int error_code) {}
static void x11_receive(Plug *plug, int urgent, const char *data, size_t len) {}
static void x11_sent(Plug *plug, size_t bufsize) {}
static void x11_closing(Plug *plug, const char *error_msg, int error_code,
bool calling_back)
static void x11_closing(Plug *plug, const char *error_msg, int error_code)
{
time_to_die = true;
}

View File

@ -273,8 +273,7 @@ static void server_log(Plug *plug, PlugLogType type, SockAddr *addr, int port,
log_to_stderr(-1, error_msg);
}
static void server_closing(Plug *plug, const char *error_msg, int error_code,
bool calling_back)
static void server_closing(Plug *plug, const char *error_msg, int error_code)
{
log_to_stderr(-1, error_msg);
}

View File

@ -482,8 +482,7 @@ static void server_log(Plug *plug, PlugLogType type, SockAddr *addr, int port,
log_to_stderr((unsigned)-1, error_msg);
}
static void server_closing(Plug *plug, const char *error_msg, int error_code,
bool calling_back)
static void server_closing(Plug *plug, const char *error_msg, int error_code)
{
log_to_stderr((unsigned)-1, error_msg);
}

View File

@ -53,10 +53,10 @@ static size_t handle_gotdata(
HandleSocket *hs = (HandleSocket *)handle_get_privdata(h);
if (err) {
plug_closing(hs->plug, "Read error from handle", 0, 0);
plug_closing(hs->plug, "Read error from handle", 0);
return 0;
} else if (len == 0) {
plug_closing(hs->plug, NULL, 0, 0);
plug_closing(hs->plug, NULL, 0);
return 0;
} else {
assert(hs->frozen != FROZEN && hs->frozen != THAWING);
@ -107,7 +107,7 @@ static void handle_sentdata(struct handle *h, size_t new_backlog, int err,
}
if (err) {
plug_closing(hs->plug, win_strerror(err), err, 0);
plug_closing(hs->plug, win_strerror(err), err);
return;
}

View File

@ -1353,7 +1353,7 @@ static void socket_error_callback(void *vs)
* An error has occurred on this socket. Pass it to the plug.
*/
plug_closing(s->plug, winsock_error_string(s->pending_error),
s->pending_error, 0);
s->pending_error);
}
/*
@ -1528,7 +1528,7 @@ void select_result(WPARAM wParam, LPARAM lParam)
}
}
if (err != 0)
plug_closing(s->plug, winsock_error_string(err), err, 0);
plug_closing(s->plug, winsock_error_string(err), err);
return;
}
@ -1590,9 +1590,9 @@ void select_result(WPARAM wParam, LPARAM lParam)
}
}
if (ret < 0) {
plug_closing(s->plug, winsock_error_string(err), err, 0);
plug_closing(s->plug, winsock_error_string(err), err);
} else if (0 == ret) {
plug_closing(s->plug, NULL, 0, 0);
plug_closing(s->plug, NULL, 0);
} else {
plug_receive(s->plug, atmark ? 0 : 1, buf, ret);
}
@ -1608,7 +1608,7 @@ void select_result(WPARAM wParam, LPARAM lParam)
noise_ultralight(NOISE_SOURCE_IOLEN, ret);
if (ret <= 0) {
int err = p_WSAGetLastError();
plug_closing(s->plug, winsock_error_string(err), err, 0);
plug_closing(s->plug, winsock_error_string(err), err);
} else {
plug_receive(s->plug, 2, buf, ret);
}
@ -1631,12 +1631,12 @@ void select_result(WPARAM wParam, LPARAM lParam)
err = p_WSAGetLastError();
if (err == WSAEWOULDBLOCK)
break;
plug_closing(s->plug, winsock_error_string(err), err, 0);
plug_closing(s->plug, winsock_error_string(err), err);
} else {
if (ret)
plug_receive(s->plug, 0, buf, ret);
else
plug_closing(s->plug, NULL, 0, 0);
plug_closing(s->plug, NULL, 0);
}
} while (ret > 0);
return;