-static int x11_receive (Socket s, int urgent, char *data, int len) {
- struct X11Private *pr = (struct X11Private *)sk_get_private_ptr(s);
+static int x11_closing (Plug plug, char *error_msg, int error_code, int calling_back) {
+ 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);
+ return 1;
+}
+
+static int x11_receive (Plug plug, int urgent, char *data, int len) {
+ struct X11Private *pr = (struct X11Private *) plug;