koron / go-ssdp

SSDP library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Send bye message when closing advertiser

andig opened this issue · comments

commented

This is a follow-up to #14. When the advertiser starts, it automatically sends the announce message. However, when the advertiser is stopped, the bye message is not sent automatically. I‘d suggest to always send the bye message if it has not already been sent from client code when stopping the advertiser.

Sorry but No.

I won't make go-ssdp's Advertiser sending Bye automatically.
It is a breaking change on Advertiser's current behavior and usage.

And, it is easy to that creating a wrapper with your suggested behavior.
Just call Bye() before Close().

commented

Ok, understood. I‘m still wondering what is the reasoning though? If you want to have the all-in-one I‘d use the advertiser instead of calling all functions individually. Why would the advertiser intentionally leave out this single piece of the flow? Is there any reasoning apart from the fact that it changes behaviour? The latter could be remedied by making this change in a major version (using go modules).