{
struct X11Private *pr = (struct X11Private *) plug;
- /*
- * We have no way to communicate down the forwarded connection,
- * so if an error occurred on the socket, we just ignore it
- * and treat it like a proper close.
- */
- sshfwd_close(pr->c);
- x11_close(pr->s);
+ if (error_msg) {
+ /*
+ * Socket error. Slam the connection instantly shut.
+ */
+ sshfwd_unclean_close(pr->c);
+ } else {
+ /*
+ * Ordinary EOF received on socket. Send an EOF on the SSH
+ * channel.
+ */
+ if (pr->c)
+ sshfwd_write_eof(pr->c);
+ }
+
return 1;
}
memset(reply + 8, 0, msgsize);
memcpy(reply + 8, message, msglen);
sshfwd_write(pr->c, (char *)reply, 8 + msgsize);
- sshfwd_close(pr->c);
- x11_close(s);
+ sshfwd_write_eof(pr->c);
sfree(reply);
sfree(message);
return 0;
return sk_write(s, data, len);
}
+
+void x11_send_eof(Socket s)
+{
+ sk_write_eof(s);
+}