Open tongchengbin opened 1 month ago
I see that you are closing the channel here "close(source.Packets())", like this.
You are closing the channel right after the go routine. Try using defer in your code.
defer close(source.Packets())
This way the channel will only be closed, when the function completes its execution (function returns).
I want to create a temporary source and close it after use. The handle needs to be used for a longer period of time, but after I finally close the handle, it results in the source channel being closed multiple times.