Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
SANE (Public)
drasyl
Commits
f29e9519
Commit
f29e9519
authored
Aug 27, 2021
by
bornholdt
Browse files
!
parent
22b52df5
Pipeline
#86902
passed with stages
in 8 minutes and 24 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
drasyl-core/src/main/java/org/drasyl/channel/arq/StopAndWaitArqHandler.java
View file @
f29e9519
...
...
@@ -93,10 +93,9 @@ public class StopAndWaitArqHandler extends ChannelDuplexHandler {
final
Object
msg
)
{
if
(
msg
instanceof
StopAndWaitArqData
)
{
final
StopAndWaitArqData
data
=
(
StopAndWaitArqData
)
msg
;
LOG
.
trace
(
"[{}] Got {}"
,
ctx
.
channel
().
id
().
asShortText
(),
data
);
if
(
inboundSequenceNo
==
data
.
sequenceNo
())
{
LOG
.
trace
(
"DATA ja"
);
LOG
.
trace
(
"[{}] Got expected {}. Pass through DATA."
,
ctx
.
channel
().
id
().
asShortText
(),
data
);
// expected sequence no -> pass DATA inbound
ctx
.
fireChannelRead
(
msg
);
...
...
@@ -104,7 +103,7 @@ public class StopAndWaitArqHandler extends ChannelDuplexHandler {
inboundSequenceNo
=
!
inboundSequenceNo
;
}
else
{
LOG
.
trace
(
"
DATA nein"
);
LOG
.
trace
(
"
[{}] Got unexpected {}. Drop DATA."
,
ctx
.
channel
().
id
().
asShortText
(),
data
);
}
// reply with ACK
...
...
@@ -112,16 +111,15 @@ public class StopAndWaitArqHandler extends ChannelDuplexHandler {
}
else
if
(
msg
instanceof
StopAndWaitArqAck
)
{
final
StopAndWaitArqAck
ack
=
(
StopAndWaitArqAck
)
msg
;
LOG
.
trace
(
"[{}] Got {}"
,
ctx
.
channel
().
id
().
asShortText
(),
ack
);
final
Boolean
outboundSequenceNo
=
outboundSequenceNo
();
if
(
outboundSequenceNo
!=
null
&&
outboundSequenceNo
==
ack
.
sequenceNo
())
{
LOG
.
trace
(
"
ACK ja"
);
LOG
.
trace
(
"
[{}] Got expected {}. Succeed DATA."
,
ctx
.
channel
().
id
().
asShortText
(),
ack
);
succeedCurrentWrite
();
writeNextPending
(
ctx
);
}
else
{
LOG
.
trace
(
"
ACK nein"
);
LOG
.
trace
(
"
[{}] Got unexpected {}. Ignore."
,
ctx
.
channel
().
id
().
asShortText
(),
ack
);
}
}
else
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment