diff options
| author | Laxmikant Rashinkar <LK.Rashinkar@gmail.com> | 2012-11-09 19:55:21 -0800 |
|---|---|---|
| committer | Laxmikant Rashinkar <LK.Rashinkar@gmail.com> | 2012-11-09 19:55:21 -0800 |
| commit | edf5971cefc98695503dca3fee2d47cd849e56c3 (patch) | |
| tree | 3e7110353bae7133c7653eda1b3f4c5ae728fa76 /xrdpapi/xrdpapi.c | |
| parent | 77e74e8e680d432769112492d14d05909eb15ebc (diff) | |
| download | xrdp-proprietary-edf5971cefc98695503dca3fee2d47cd849e56c3.tar.gz xrdp-proprietary-edf5971cefc98695503dca3fee2d47cd849e56c3.zip | |
o in login dialog set sesman-X11rdp as the default module
o added support for video redirection without using TSMF
Diffstat (limited to 'xrdpapi/xrdpapi.c')
| -rw-r--r-- | xrdpapi/xrdpapi.c | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/xrdpapi/xrdpapi.c b/xrdpapi/xrdpapi.c index e320ef5d..973deb48 100644 --- a/xrdpapi/xrdpapi.c +++ b/xrdpapi/xrdpapi.c @@ -152,57 +152,57 @@ WTSVirtualChannelOpenEx(unsigned int SessionId, const char *pVirtualName, return wts; } +/* + * write data to client connection + * + * @return 0 on success, -1 on error /*****************************************************************************/ int WTSVirtualChannelWrite(void *hChannelHandle, const char *Buffer, unsigned int Length, unsigned int *pBytesWritten) { struct wts_obj *wts; - int error; - int lerrno; + int rv; - wts = (struct wts_obj *)hChannelHandle; + wts = (struct wts_obj *) hChannelHandle; + + *pBytesWritten = 0; if (wts == 0) { - return 0; + LLOGLN(10, ("WTSVirtualChannelWrite: wts is NULL")); + return -1; } if (wts->status != 1) { - return 0; + LLOGLN(10, ("WTSVirtualChannelWrite: wts->status != 1")); + return -1; } - if (can_send(wts->fd, 0)) + if (!can_send(wts->fd, 0)) { - error = send(wts->fd, Buffer, Length, 0); + return 0; /* can't write now, ok to try again */ + } - if (error == -1) - { - lerrno = errno; + rv = send(wts->fd, Buffer, Length, 0); + LLOGLN(10, ("WTSVirtualChannelWrite: send() reted %d", rv)); - if ((lerrno == EWOULDBLOCK) || (lerrno == EAGAIN) || - (lerrno == EINPROGRESS)) - { - *pBytesWritten = 0; - return 1; - } + if (rv >= 0) + { + /* success, but zero bytes may have been written */ + *pBytesWritten = rv; + return 0; + } - return 0; - } - else if (error == 0) - { - return 0; - } - else if (error > 0) - { - *pBytesWritten = error; - return 1; - } + /* error, but is it ok to try again? */ + if ((rv == EWOULDBLOCK) || (rv == EAGAIN) || (rv == EINPROGRESS)) + { + return 0; /* failed to send, but should try again */ } - *pBytesWritten = 0; - return 1; + /* fatal error */ + return -1; } /*****************************************************************************/ @@ -241,6 +241,7 @@ WTSVirtualChannelRead(void *hChannelHandle, unsigned int TimeOut, *pBytesRead = 0; return 1; } + return 0; } else if (rv == 0) |
