~roger.light/ubuntu/vivid/libwebsockets/fix-for-1422623

« back to all changes in this revision

Viewing changes to test-server/test-ping.c

  • Committer: Roger A. Light
  • Date: 2015-02-19 16:00:08 UTC
  • mfrom: (1.1.1)
  • Revision ID: roger@atchoo.org-20150219160008-162cd9naiu2yekny
New upstream release 1.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
#include <stdio.h>
23
23
#include <stdlib.h>
24
 
#include <unistd.h>
25
24
#include <getopt.h>
26
25
#include <string.h>
27
26
#include <signal.h>
28
 
#include <unistd.h>
29
 
 
30
 
#include <sys/time.h>
31
27
#include <sys/types.h>
32
 
#ifndef WIN32
 
28
 
 
29
#ifndef _WIN32
 
30
#include <netdb.h>
33
31
#include <sys/socket.h>
 
32
#include <sys/time.h>
34
33
#include <sys/ioctl.h>
35
34
#include <poll.h>
 
35
#include <unistd.h>
36
36
#endif
37
37
 
38
 
#include <netdb.h>
 
38
#ifdef CMAKE_BUILD
 
39
#include "lws_config.h"
 
40
#endif
39
41
 
40
42
#include "../lib/libwebsockets.h"
41
43
 
255
257
                global_tx_count++;
256
258
 
257
259
                if (use_mirror)
258
 
                        libwebsocket_write(wsi,
 
260
                        n = libwebsocket_write(wsi,
259
261
                                &pingbuf[LWS_SEND_BUFFER_PRE_PADDING],
260
262
                                        size, write_options | LWS_WRITE_BINARY);
261
263
                else
262
 
                        libwebsocket_write(wsi,
 
264
                        n = libwebsocket_write(wsi,
263
265
                                &pingbuf[LWS_SEND_BUFFER_PRE_PADDING],
264
266
                                        size, write_options | LWS_WRITE_PING);
265
267
 
 
268
                if (n < 0)
 
269
                        return -1;
 
270
                if (n < size) {
 
271
                        lwsl_err("Partial write\n");
 
272
                        return -1;
 
273
                }
 
274
 
266
275
                if (flood &&
267
276
                         (psd->ping_index - psd->rx_count) < (screen_width - 1))
268
277
                        fprintf(stderr, ".");