Skip to content

Commit

Permalink
Merge pull request #73 from eisenhauer/WinNet
Browse files Browse the repository at this point in the history
  • Loading branch information
eisenhauer authored Aug 15, 2023
2 parents 28bf57a + 602a1d5 commit 657c7fa
Show file tree
Hide file tree
Showing 42 changed files with 50 additions and 38 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.5)

# The directory label is used for CDash to treat EVPath as a subproject of
# GTKorvo
Expand Down
1 change: 1 addition & 0 deletions cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <stdlib.h>
#include <limits.h>
#ifdef HAVE_WINDOWS_H
#define FD_SETSIZE 1024
#include <winsock2.h>
#define __ANSI_CPP__
#else
Expand Down
1 change: 1 addition & 0 deletions cm_evol.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#endif
#include <stdlib.h>
#ifdef HAVE_WINDOWS_H
#define FD_SETSIZE 1024
#include <winsock2.h>
#define __ANSI_CPP__
#else
Expand Down
1 change: 1 addition & 0 deletions cm_pbio.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#endif
#include <string.h>
#ifdef HAVE_WINDOWS_H
#define FD_SETSIZE 1024
#include <winsock2.h>
#else
#include <netinet/in.h>
Expand Down
1 change: 1 addition & 0 deletions cm_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#endif
#include <stdlib.h>
#ifdef HAVE_WINDOWS_H
#define FD_SETSIZE 1024
#include <winsock2.h>
#define __ANSI_CPP__
#else
Expand Down
1 change: 1 addition & 0 deletions cm_schedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ extern "C" {
#endif

#ifdef _MSC_VER
#define FD_SETSIZE 1024
#include <winsock2.h>
#endif
typedef struct _avail_period {
Expand Down
1 change: 1 addition & 0 deletions cmenet.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#undef NDEBUG
#ifdef HAVE_WINDOWS_H
#define FD_SETSIZE 1024
#include <winsock2.h>
#include <windows.h>
#include <process.h>
Expand Down
1 change: 1 addition & 0 deletions cmepoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <sys/types.h>

#ifdef HAVE_WINDOWS_H
#define FD_SETSIZE 1024
#include <winsock2.h>
#include <windows.h>
#include <sys/timeb.h>
Expand Down
1 change: 1 addition & 0 deletions cmib.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <sys/types.h>

#ifdef HAVE_WINDOWS_H
#define FD_SETSIZE 1024
#include <winsock2.h>
#include <windows.h>
#define getpid() _getpid()
Expand Down
1 change: 1 addition & 0 deletions cmmulticast.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <sys/types.h>

#ifdef HAVE_WINDOWS_H
#define FD_SETSIZE 1024
#include <winsock2.h>
#include <ws2ipdef.h>
#include <windows.h>
Expand Down
14 changes: 7 additions & 7 deletions cmselect.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <sys/types.h>

#ifdef HAVE_WINDOWS_H
#define FD_SETSIZE 1024
#include <winsock2.h>
#include <windows.h>
#include <sys/timeb.h>
Expand Down Expand Up @@ -121,8 +122,8 @@ typedef struct select_data {
int closed;
CManager cm;
int select_consistency_number;
int wake_read_fd;
int wake_write_fd;
SOCKET wake_read_fd;
SOCKET wake_write_fd;
} *select_data_ptr;

static void wake_server_thread(select_data_ptr socket_data);
Expand Down Expand Up @@ -879,8 +880,7 @@ int err;
*/

int
pipe(filedes)
SOCKET filedes[2];
pipe(SOCKET *filedes)
{

int length;
Expand Down Expand Up @@ -970,23 +970,23 @@ SOCKET filedes[2];
static void
setup_wake_mechanism(CMtrans_services svc, select_data_ptr *sdp)
{
int filedes[2];
SOCKET filedes[2];

select_data_ptr sd = *((select_data_ptr *)sdp);
if (sd->cm) {
/* assert CM is locked */
assert(CM_LOCKED(svc, sd->cm));
}
if (sd->wake_read_fd != -1) return;
if (pipe(filedes) != 0) {
if (pipe(&filedes[0]) != 0) {
perror("Pipe for wake not created. Wake mechanism inoperative.");
return;
}
sd->wake_read_fd = filedes[0];
sd->wake_write_fd = filedes[1];
svc->verbose(sd->cm, CMSelectVerbose, "CMSelect Adding read_wake_fd as action on fd %d",
sd->wake_read_fd);
libcmselect_LTX_add_select(svc, sdp, sd->wake_read_fd, read_wake_fd,
libcmselect_LTX_add_select(svc, sdp, (int)sd->wake_read_fd, read_wake_fd,
(void*)(intptr_t)sd->wake_read_fd, NULL);
}

Expand Down
7 changes: 3 additions & 4 deletions cmsockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <sys/types.h>

#ifdef HAVE_WINDOWS_H
#define FD_SETSIZE 1024
#include <winsock2.h>
#include <windows.h>
#include <process.h>
Expand Down Expand Up @@ -782,7 +783,7 @@ libcmsockets_LTX_non_blocking_listen(CManager cm, CMtrans_services svc, transpor
return NULL;
}
sd->listen_fds = realloc(sd->listen_fds,
sizeof(int)*(sd->listen_count+1));
sizeof(SOCKET)*(sd->listen_count+1));
sd->listen_ports = realloc(sd->listen_ports,
sizeof(int)*(sd->listen_count+1));
sd->listen_fds[sd->listen_count] = conn_sock;
Expand Down Expand Up @@ -973,12 +974,10 @@ int iovcnt;
{
ssize_t wrote = 0;
int i;
printf("tmp Writev iovcnt %d\n", iovcnt);
for (i = 0; i < iovcnt; i++) {
size_t left = iov[i].iov_len;
ssize_t iget = 0;

printf("Writing block[%d] of len %zu, startig at %p\n", i, left, iov[i].iov_base);
while (left > 0) {
errno = 0;
size_t this_write = left;
Expand Down Expand Up @@ -1208,7 +1207,7 @@ libcmsockets_LTX_initialize(CManager cm, CMtrans_services svc, transport_entry t
socket_data->svc = svc;
socket_data->characteristics = create_attr_list();
socket_data->listen_count = 0;
socket_data->listen_fds = malloc(sizeof(int));
socket_data->listen_fds = malloc(sizeof(SOCKET));
socket_data->listen_ports = malloc(sizeof(int));
add_int_attr(socket_data->characteristics, CM_TRANSPORT_RELIABLE, 1);
svc->add_shutdown_task(cm, free_socket_data, (void *) socket_data, FREE_TASK);
Expand Down
1 change: 1 addition & 0 deletions cmudp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <sys/types.h>

#ifdef HAVE_WINDOWS_H
#define FD_SETSIZE 1024
#include <winsock2.h>
#include <windows.h>
#define getpid() _getpid()
Expand Down
1 change: 1 addition & 0 deletions ip_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <sys/sockio.h>
#endif
#ifdef HAVE_WINDOWS_H
#define FD_SETSIZE 1024
#include <winsock2.h>
#include <Ws2def.h>
#include <ws2tcpip.h>
Expand Down
1 change: 1 addition & 0 deletions qual_hostname.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <sys/sockio.h>
#endif
#ifdef HAVE_WINDOWS_H
#define FD_SETSIZE 1024
#include <winsock2.h>
#define __ANSI_CPP__
#else
Expand Down
2 changes: 1 addition & 1 deletion tests/auto_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ do_regression_master_test()
int message_count = 0, i;
EVstone handle;
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
SetTimer(NULL, 5, 300*1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/block_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ do_regression_master_test()
int expected_count = msg_limit;
int done = 0;
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
SetTimer(NULL, 5, 300*1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/bulktest.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ do_regression_master_test()
EVstone handle;
int done = 0;
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC)fail_and_die);
SetTimer(NULL, 5, 300*1000, (TIMERPROC)fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/cmconn.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ do_regression_master_test()
CMFormat format;
int message_count = 0;
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
SetTimer(NULL, 5, 300*1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/cmping.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ do_regression_master_test()
char *string_list, *transport;
int message_count = 0;
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
SetTimer(NULL, 5, 300*1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/congest_bulktest.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ do_regression_master_test()
int expected_count = msg_limit;
int done = 0;
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
SetTimer(NULL, 5, 300*1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/congestion_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ do_regression_master_test()
int expected_count = msg_limit;
int done = 0;
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
SetTimer(NULL, 5, 300*1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/evtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ do_regression_master_test()
EVstone handle;
int i;
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
SetTimer(NULL, 5, 300*1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/extract_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ do_regression_master_test()
EVstone term0, term1, term2;
struct _client_rec rec0, rec1, rec2;
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
SetTimer(NULL, 5, 300*1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/filter2_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ do_regression_master_test()
EVstone term, fstone;
EVaction faction;
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
SetTimer(NULL, 5, 300*1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/filter_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ do_regression_master_test(int do_dll)
EVstone term, fstone;
EVaction faction;
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
SetTimer(NULL, 5, 300*1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/http_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ do_regression_master_test()
EVstone handle;
int i;
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
SetTimer(NULL, 5, 300*1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/multi_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ main(int argc, char **argv)
srand48(getpid());

#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
SetTimer(NULL, 5, 300*1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/multiq_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ do_regression_master_test()
EVaction faction;
int i;
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
SetTimer(NULL, 5, 300*1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/no_type_router_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ do_regression_master_test()
int i;
struct _client_rec rec0, rec1, rec2;
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
SetTimer(NULL, 5, 300*1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/rawtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ do_regression_master_test()
simple_rec data;
EVsource source_handle;
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
SetTimer(NULL, 5, 300*1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/rawtest2.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ do_regression_master_test()
simple_rec data;
EVsource source_handle;
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
SetTimer(NULL, 5, 300*1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/router_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ do_regression_master_test()
EVaction faction;
struct _client_rec rec0, rec1, rec2;
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
SetTimer(NULL, 5, 300*1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/router_test2.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ do_regression_master_test()
EVstone term0, term1, term2;
struct _client_rec rec0, rec1, rec2;
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
SetTimer(NULL, 5, 300*1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/split_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ do_regression_master_test()
int message_count = 0;
EVstone handle;
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
SetTimer(NULL, 5, 300*1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/store_limit_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ do_regression_master_test()
EVstone term, fstone;
EVaction faction;
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
SetTimer(NULL, 5, 300*1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/store_send_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ do_regression_master_test()
EVstone term, fstone;
EVaction faction;
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
SetTimer(NULL, 5, 300*1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
Expand Down
Loading

0 comments on commit 657c7fa

Please sign in to comment.