Skip to content

net/tcp: Remove the unused TCP_STOPPED flags#7528

Closed
xiaoxiang781216 wants to merge 1 commit intoapache:masterfrom
xiaoxiang781216:tcp
Closed

net/tcp: Remove the unused TCP_STOPPED flags#7528
xiaoxiang781216 wants to merge 1 commit intoapache:masterfrom
xiaoxiang781216:tcp

Conversation

@xiaoxiang781216
Copy link
Copy Markdown
Contributor

@xiaoxiang781216 xiaoxiang781216 commented Nov 4, 2022

Summary

report here: #4005

Impact

Remove the dead code

Testing

Pass CI

report here:
apache#4005

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
@xiaoxiang781216 xiaoxiang781216 requested a review from yamt November 4, 2022 14:29
@xiaoxiang781216 xiaoxiang781216 linked an issue Nov 4, 2022 that may be closed by this pull request
@acassis acassis requested a review from antmerlino November 4, 2022 18:03
@acassis
Copy link
Copy Markdown
Contributor

acassis commented Nov 4, 2022

@xiaoxiang781216 since this PR touch 6LoWPAN I added @antmerlino because he depends on it for this drone swarm company.

Copy link
Copy Markdown
Contributor

@antmerlino antmerlino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @xiaoxiang781216

I am not on the latest codebase and it is not trivial for me to bring my code up to the latest, however I seem to recall this code being added to 6lowpan for a legitimate reason. I recall problems during an FTP transfer from a Windows client. I believe this STOPPED flag is a legitimate part of TCP and it's use here is proper.

I see now a conversation with Greg in another issue trying to recall why STOPPED got added. Can't we look this up via Git history? In any case, I would strongly prefer us to leave this code in 6lowpan.

@xiaoxiang781216
Copy link
Copy Markdown
Contributor Author

@antmerlino the code just set STOPPED bit, but no place check this flag and do the different action. So, it is dead code, please find the right time to check it again. It isnot a critical issue, let wait you.

/* Set the TCP window */
/* Update the TCP received window based on I/O buffer availability */

if (conn->tcpstateflags & TCP_STOPPED)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xiaoxiang781216 The flag is checked right here. It sets the window to zero so that the host stops sending data. Why do you say that the code is dead?

Copy link
Copy Markdown
Contributor Author

@xiaoxiang781216 xiaoxiang781216 Nov 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I mean there isn't code to set STOPPED flag, not the check:(. So, the if block never execute.

Copy link
Copy Markdown
Contributor

@antmerlino antmerlino Nov 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I can't seem to find whether it was ever set or not. Alot has changed. I can try and dig into it later, but not sure when I'll have time. If it wasn't ever fully supported, then it likely came from the Contiki port that Greg originally did.

In either case - why get rid of this logic? It seems like the right behavior, even if we don't look for the STOPPED flag right now. If we were to look for the STOPPED flag, then this would be right. What's the rationale for removing it?

The STOPPED flag is a legitimate TCP flag. This logic, likely copied from Contiki, is correct. I think we should either set the STOPPED flag and allow this logic to do it's job, or not remove it and leave it as is.

Copy link
Copy Markdown
Contributor Author

@xiaoxiang781216 xiaoxiang781216 Nov 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that the code doesn't work as expect. If someone plan to implement shutdown function in the future, he will bring back the similar code.
I am fine to keep the dead code, @patacongo what your opinion?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate on what doesn't work as expected? Maybe we can just fix it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because nobody set STOPPED flag, one improvement is implement shutdown as @patacongo mention which will set STOPPED definitely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TCP_STOPPED is unused

4 participants