-
Notifications
You must be signed in to change notification settings - Fork 29
replace AddHandler with Listen #79
Copy link
Copy link
Open
Labels
effort/daysEstimated to take multiple days, but less than a weekEstimated to take multiple days, but less than a weekexp/intermediatePrior experience is likely helpfulPrior experience is likely helpfulkind/architectureCore architecture of projectCore architecture of project
Metadata
Metadata
Assignees
Labels
effort/daysEstimated to take multiple days, but less than a weekEstimated to take multiple days, but less than a weekexp/intermediatePrior experience is likely helpfulPrior experience is likely helpfulkind/architectureCore architecture of projectCore architecture of project
@Stebalien suggested to replace the
AddHandler(which gets passed a callback) with aListen(... protocol.ID)function, returning aListener, on which anAcceptmethod could be called to accept streams.This would be a more idiomatic approach, as it closely mirrors how
net.Conns and streams are accepted. It would also move the go routine handling to the application, which is arguably the place where it belongs.