int SSH2Channel::requestX11Forwarding(ExceptionSink *xsink, int screen_number, bool single_connection, const char *auth_proto, const char *auth_cookie, int timeout_ms) { AutoLocker al(parent->m); if (check_open(xsink)) return -1; BlockingHelper bh(parent); //printd(5, "SSH2Channel::requestX11Forwarding() screen_no=%d, single=%s, ap=%s, ac=%s\n", screen_number, single_connection ? "true" : "false", auth_proto ? auth_proto : "n/a", auth_cookie ? auth_cookie : "n/a"); int rc; while (true) { rc = libssh2_channel_x11_req_ex(channel, (int)single_connection, auth_proto, auth_cookie, screen_number); if (rc == LIBSSH2_ERROR_EAGAIN) { if ((rc = parent->waitSocketUnlocked(xsink, SSH2CHANNEL_TIMEOUT, "SSH2CHANNEL-REQUESTX11FORWARDING-ERROR", "SSH2Channel::requestX11Forwarding", timeout_ms))) break; continue; } if (rc < 0) parent->doSessionErrUnlocked(xsink); break; } return rc; }
static PyObject * channel_x11_req(SSH2_ChannelObj *self, PyObject *args, PyObject *kwds) { int screen_number; int single_connection = 0; int ret; char *auth_proto = NULL; char *auth_cookie = NULL; static char *kwlist[] = {"screen_number", "single_connection", "auth_proto", "auth_cookie", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "i|iss", kwlist, &screen_number, &single_connection, &auth_proto, &auth_cookie)) return NULL; Py_BEGIN_ALLOW_THREADS ret = libssh2_channel_x11_req_ex(self->channel, single_connection, auth_proto, auth_cookie, screen_number); Py_END_ALLOW_THREADS CHECK_RETURN_CODE(ret, self->session) Py_RETURN_NONE; }