Skip to content

Commit 51e4872

Browse files
Shot in the dark fix for TCP_KEEPALIVE in Windows
1 parent 010336d commit 51e4872

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

library.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
#ifdef HAVE_CONFIG_H
22
#include "config.h"
33
#endif
4+
45
#include "common.h"
56
#include "php_network.h"
67
#include <sys/types.h>
7-
#ifndef _MSC_VER
8-
#include <netinet/tcp.h> /* TCP_NODELAY */
9-
#include <sys/socket.h>
10-
#endif
8+
119
#ifdef HAVE_REDIS_IGBINARY
1210
#include "igbinary/igbinary.h"
1311
#endif
12+
1413
#ifdef HAVE_REDIS_LZF
1514
#include <lzf.h>
1615
#endif
16+
1717
#include <zend_exceptions.h>
1818
#include "php_redis.h"
1919
#include "library.h"
@@ -29,7 +29,12 @@
2929
#define SCORE_DECODE_INT 1
3030
#define SCORE_DECODE_DOUBLE 2
3131

32-
#ifdef PHP_WIN32
32+
#ifndef PHP_WIN32
33+
#include <netinet/tcp.h> /* TCP_NODELAY */
34+
#include <sys/socket.h> /* SO_KEEPALIVE */
35+
#else
36+
#include <winsock.h>
37+
3338
# if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION <= 4
3439
/* This proto is available from 5.5 on only */
3540
PHP_REDIS_API int usleep(unsigned int useconds);

redis_commands.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@
2525
#include "redis_commands.h"
2626

2727
#include "php_network.h"
28-
#include <netinet/tcp.h> /* TCP_KEEPALIVE */
28+
29+
#ifndef PHP_WIN32
30+
#include <netinet/tcp.h> /* TCP_KEEPALIVE */
31+
#else
32+
#include <winsock.h>
33+
#endif
2934

3035
#include <zend_exceptions.h>
3136

0 commit comments

Comments
 (0)