go-libp2p-pubsub icon indicating copy to clipboard operation
go-libp2p-pubsub copied to clipboard

Next function returns own messages

Open l0k18 opened this issue 2 years ago • 2 comments
trafficstars

Sorry if this is a duplicate. It is happening with v0.9.3, which appears to be the current latest version.

The title really says it all. I added this code to my handler to abort doing any work if the sender is the receiver:

	if p.ReceivedFrom == ng.Listener.Host.ID() {
		return
	}

Yes, Listener.Host is libp2p.Host.

It seems to me that the Next function should not deliver messages that the pubsub sent. At least it should be an option to suppress it.

l0k18 avatar Jul 21 '23 09:07 l0k18

This is the default behavior of broadcast protocols; a pr would be welcome if you want to add an option to disable this behavior.

vyzo avatar Jul 27 '23 18:07 vyzo

This is the default behavior of broadcast protocols; a pr would be welcome if you want to add an option to disable this behavior.

I will attach one to this issue in the near future, A parameter and that code more or less.

l0k18 avatar Jul 29 '23 15:07 l0k18