From 765948c5ff9769d2f5585e30b357d89c2a187394 Mon Sep 17 00:00:00 2001 From: "David.Gao" Date: Mon, 4 Oct 2021 10:59:36 +0800 Subject: [PATCH] brust and delete log --- include/aiutp.hrl | 2 +- src/aiutp_net.erl | 4 ++-- src/aiutp_pcb.erl | 6 ------ 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/include/aiutp.hrl b/include/aiutp.hrl index 13ecfe3..bb64d0d 100644 --- a/include/aiutp.hrl +++ b/include/aiutp.hrl @@ -167,7 +167,7 @@ % per 5 seconds ssthresh = ?OUTGOING_BUFFER_MAX_SIZE * ?PACKET_SIZE, slow_start = true, - brust = fasle, + brust = true, inbuf, outbuf, inque, diff --git a/src/aiutp_net.erl b/src/aiutp_net.erl index b65e0c8..ce1f727 100644 --- a/src/aiutp_net.erl +++ b/src/aiutp_net.erl @@ -122,9 +122,9 @@ send_ack(#aiutp_pcb{time = Now, PCB#aiutp_pcb{last_sent_packet = Now,last_rcv_win = WindowSize}. -send_keep_alive(#aiutp_pcb{ack_nr = AckNR} = PCB)-> +send_keep_alive(#aiutp_pcb{conn_id_recv = ConnId,ack_nr = AckNR} = PCB)-> PCB0 = send_ack(PCB#aiutp_pcb{ack_nr = aiutp_util:bit16(AckNR -1)}), - io:format("send keep alive: ~p~n",[AckNR]), + io:format("ConnId:~p send keep alive: ~p~n",[ConnId,AckNR]), PCB0#aiutp_pcb{ack_nr = AckNR}. update_wrap_packet(MicroNow,ReplyMicro,WindowSize,AckNR,WrapPacket)-> diff --git a/src/aiutp_pcb.erl b/src/aiutp_pcb.erl index 47a775d..4aaf2fa 100644 --- a/src/aiutp_pcb.erl +++ b/src/aiutp_pcb.erl @@ -108,7 +108,6 @@ process(_, if ((PktType /= ?ST_SYN) or (State /= ?CS_SYN_RECV)) and (?WRAPPING_DIFF_16(MaxSeqNR,PktAckNR) < 0) or (?WRAPPING_DIFF_16(PktAckNR, MinSeqNR) < 0) -> - io:format("ConnId: ~p drop packet in process PktSeqNR: ~p PktAckNR: ~p ~n ",[ConnId,PktSeqNR,PktAckNR]), PCB; % ignore packets whose ack_nr is invalid. This would imply a spoofed address % or a malicious attempt to attach the uTP implementation. @@ -121,10 +120,6 @@ process(_, process_packet(#aiutp_packet{type = PktType,seq_nr = PktSeqNR,conn_id = ConnId,ack_nr = PktAckNR} = Packet, #aiutp_pcb{state = State} = PCB)-> Now = aiutp_util:millisecond(), - if PktType == ?ST_DATA -> - io:format("ConnId: ~p recv packet PktSeqNR: ~p PktAckNR: ~p~n",[ConnId,PktSeqNR,PktAckNR]); - true -> ok - end, PCB0 = if State == ?CS_SYN_SENT -> % if this is a syn-ack, initialize our ack_nr @@ -141,7 +136,6 @@ process_packet(#aiutp_packet{type = PktType,seq_nr = PktSeqNR,conn_id = ConnId,a % current. Subtracring 1 makes 0 mean "this is the next % expected packet". if SeqDistance >= ?REORDER_BUFFER_MAX_SIZE -> - io:format("ConnId: ~p drop packet in process_packet PktSeqNR: ~p PktAckNR: ~p ~n ",[ConnId,PktSeqNR,PktAckNR]), if (SeqDistance >= (?SEQ_NR_MASK + 1 - ?REORDER_BUFFER_MAX_SIZE)) and (PktType /= ?ST_STATE) -> PCB0#aiutp_pcb{ida = true}; true -> PCB0