mirror of
https://github.com/hufrea/byedpi.git
synced 2025-03-14 12:58:48 +03:00
usleep to nanosleep
This commit is contained in:
parent
901548ba0e
commit
5c6d706cea
4 changed files with 10 additions and 4 deletions
2
Makefile
2
Makefile
|
@ -1,6 +1,6 @@
|
|||
TARGET = ciadpi
|
||||
CC ?= gcc
|
||||
CFLAGS += -std=c99 -O2
|
||||
CFLAGS += -std=c99 -O2 -D_XOPEN_SOURCE=500
|
||||
SOURCES = packets.c main.c conev.c proxy.c desync.c
|
||||
|
||||
all:
|
||||
|
|
8
desync.c
8
desync.c
|
@ -1,5 +1,8 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
@ -57,7 +60,10 @@ int fake_attack(int sfd, char *buffer, ssize_t n, int cnt, int pos)
|
|||
perror("sendfile");
|
||||
break;
|
||||
}
|
||||
usleep(params.sfdelay);
|
||||
struct timespec delay = {
|
||||
.tv_nsec = params.sfdelay * 1000
|
||||
};
|
||||
nanosleep(&delay, 0);
|
||||
memcpy(p, buffer, pos);
|
||||
|
||||
if (setsockopt(sfd, IPPROTO_IP, IP_TTL,
|
||||
|
|
2
main.c
2
main.c
|
@ -341,7 +341,7 @@ int main(int argc, char **argv)
|
|||
|
||||
case 'w': //
|
||||
params.sfdelay = strtoul(optarg, &end, 0);
|
||||
if (optarg == end || *end)
|
||||
if (optarg == end || params.sfdelay > 1000000 || *end)
|
||||
invalid = 1;
|
||||
break;
|
||||
|
||||
|
|
2
params.h
2
params.h
|
@ -47,4 +47,4 @@ extern struct packet fake_http;
|
|||
#define LOG_L 2
|
||||
|
||||
#define LOG(s, str, ...) \
|
||||
if (params.debug >= s) printf(str, ##__VA_ARGS__)
|
||||
if (params.debug >= s) printf(str, ##__VA_ARGS__)
|
||||
|
|
Loading…
Add table
Reference in a new issue