/*
* libwebsockets - small server side websockets and web server implementation
*
- * Copyright (C) 2010-2013 Andy Green <andy@warmcat.com>
+ * Copyright (C) 2010-2014 Andy Green <andy@warmcat.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
#ifndef LWS_NO_EXTENSIONS
int m;
- if (wsi->truncated_send_malloc &&
- (buf < wsi->truncated_send_malloc ||
- buf > (wsi->truncated_send_malloc + wsi->truncated_send_len + wsi->truncated_send_offset))) {
- lwsl_err("****** %x Sending something else while pending truncated ...\n", wsi);
+ if (wsi->truncated_send_malloc && (buf < wsi->truncated_send_malloc ||
+ buf > (wsi->truncated_send_malloc +
+ wsi->truncated_send_len +
+ wsi->truncated_send_offset))) {
+ lwsl_err("****** %x Sending new, pending truncated ...\n", wsi);
assert(0);
}
* already handling a truncated send?
*/
if (wsi->truncated_send_malloc) {
- lwsl_info("***** %x partial send moved on by %d (vs %d)\n", wsi, n, real_len);
+ lwsl_info("***** %x partial send moved on by %d (vs %d)\n",
+ wsi, n, real_len);
wsi->truncated_send_offset += n;
wsi->truncated_send_len -= n;
* Newly truncated send. Buffer the remainder (it will get
* first priority next time the socket is writable)
*/
- lwsl_info("***** %x new partial sent %d from %d total\n", wsi, n, real_len);
+ lwsl_info("***** %x new partial sent %d from %d total\n",
+ wsi, n, real_len);
wsi->truncated_send_malloc = malloc(real_len - n);
if (!wsi->truncated_send_malloc) {
}
if ((char *)buf != eff_buf.token)
- wsi->u.ws.clean_buffer = 0; /* extension recreated it: we need to buffer this if not all sent */
+ /*
+ * extension recreated it:
+ * need to buffer this if not all sent
+ */
+ wsi->u.ws.clean_buffer = 0;
/* assuming they left us something to send, send it */
* to this being issued
*/
if ((char *)buf != eff_buf.token)
- wsi->u.ws.clean_buffer = 0; /* we need to buffer this if not all sent */
+ /*
+ * extension recreated it:
+ * need to buffer this if not all sent
+ */
+ wsi->u.ws.clean_buffer = 0;
buf = (unsigned char *)eff_buf.token;
len = eff_buf.token_len;
if (!wsi->u.ws.inside_frame)
if (libwebsocket_0405_frame_mask_generate(wsi)) {
- lwsl_err("lws_write: frame mask generation failed\n");
+ lwsl_err("frame mask generation failed\n");
return -1;
}
if (wsi->truncated_send_malloc) {
lws_issue_raw(wsi, wsi->truncated_send_malloc +
wsi->truncated_send_offset,
- wsi->truncated_send_len);
+ wsi->truncated_send_len);
continue;
}
#if defined(WIN32) || defined(_WIN32)
if (!ReadFile(wsi->u.http.fd, context->service_buffer,
- sizeof(context->service_buffer), &n, NULL))
+ sizeof(context->service_buffer), &n, NULL))
return -1; /* caller will close */
#else
n = read(wsi->u.http.fd, context->service_buffer,
if (m != n) {
/* adjust for what was not sent */
#if defined(WIN32) || defined(_WIN32)
- SetFilePointer(wsi->u.http.fd, m - n, NULL, FILE_CURRENT);
+ SetFilePointer(wsi->u.http.fd, m - n,
+ NULL, FILE_CURRENT);
#else
lseek(wsi->u.http.fd, m - n, SEEK_CUR);
#endif