fix windows compile

This commit is contained in:
wangyu- 2018-08-29 19:37:16 -05:00
parent ff39a562a6
commit 4e4a77ce16
2 changed files with 4 additions and 3 deletions

View File

@ -39,10 +39,12 @@
#endif
#include <my_ev.h>
#include <netinet/in.h>
#if defined(__MINGW32__)
#include <winsock2.h>
#include <ws2ipdef.h>
typedef unsigned char u_int8_t;
typedef unsigned short u_int16_t;
typedef unsigned int u_int32_t;
@ -51,7 +53,6 @@ typedef int socklen_t;
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#endif

View File

@ -1863,7 +1863,7 @@ int send_raw_tcp(raw_info_t &raw_info,const char * payload, int payloadlen) {
tcph->urg = 0;
//tcph->window = htons((uint16_t)(1024));
tcph->window = htons((uint16_t) (receive_window_lower_bound + random() % receive_window_random_range));
tcph->window = htons((uint16_t) (receive_window_lower_bound + get_true_random_number() % receive_window_random_range));
tcph->check = 0; //leave checksum 0 now, filled later by pseudo header
tcph->urg_ptr = 0;
@ -2802,7 +2802,7 @@ int after_send_raw0(raw_info_t &raw_info)
send_info.seq += raw_info.send_info.data_len; //////////////////modify
} else if (seq_mode == 2)
{
if (random() % 5 == 3)
if (get_true_random_number() % 5 == 3)
send_info.seq += raw_info.send_info.data_len; //////////////////modify
}
else if(seq_mode==3||seq_mode==4)