Add data structures to pool struct for socket communications.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
diff --git a/api.c b/api.c
index f9e5372..361375a 100644
--- a/api.c
+++ b/api.c
@@ -32,16 +32,6 @@
#define HAVE_AN_FPGA 1
#endif
-#if defined(unix) || defined(__APPLE__)
- #include <errno.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
-#elif defined WIN32
- #include <ws2tcpip.h>
- #include <winsock2.h>
-#endif
-
// Big enough for largest API request
// though a PC with 100s of PGAs/CPUs may exceed the size ...
// Current code assumes it can socket send this size also
diff --git a/miner.h b/miner.h
index 169c9ee..175a3fc 100644
--- a/miner.h
+++ b/miner.h
@@ -12,6 +12,7 @@
#include "elist.h"
#include "uthash.h"
#include "logging.h"
+#include "util.h"
#ifdef HAVE_OPENCL
#ifdef __APPLE_CC__
@@ -810,6 +811,9 @@ struct pool {
struct cgminer_stats cgminer_stats;
struct cgminer_pool_stats cgminer_pool_stats;
+
+ SOCKETTYPE sock;
+ struct sockaddr_in server, client;
};
#define GETWORK_MODE_TESTPOOL 'T'
diff --git a/util.h b/util.h
index 6f125be..3dcc948 100644
--- a/util.h
+++ b/util.h
@@ -2,6 +2,11 @@
#define __UTIL_H__
#if defined(unix) || defined(__APPLE__)
+ #include <errno.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+
#define SOCKETTYPE int
#define SOCKETFAIL(a) ((a) < 0)
#define INVSOCK -1
@@ -10,6 +15,9 @@
#define SOCKERRMSG strerror(errno)
#elif defined WIN32
+ #include <ws2tcpip.h>
+ #include <winsock2.h>
+
#define SOCKETTYPE SOCKET
#define SOCKETFAIL(a) ((a) == SOCKET_ERROR)
#define INVSOCK INVALID_SOCKET