Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting arguments for gen_tcp_server #2

Open
useronym opened this issue Apr 2, 2015 · 2 comments
Open

Starting arguments for gen_tcp_server #2

useronym opened this issue Apr 2, 2015 · 2 comments
Assignees

Comments

@useronym
Copy link
Contributor

useronym commented Apr 2, 2015

Hi, would you be interested in making it possible to pass in arguments to the gen_tcp_server in gen_tcp_server:start_link? This would mean introducing a new 'init' callback. Currently we use a hardcoded solution which already works, so I won't go rewriting stuff if it's something you'd be against merging in. I would of course make sure to keep backward compatibility where possible.

Let me know what you think. Thanks for a great lib, by the way :)

@rpt rpt self-assigned this Apr 7, 2015
@rpt rpt added the enhancement label Apr 7, 2015
@rpt
Copy link
Owner

rpt commented Apr 7, 2015

Wouldn't it be enough to pass arguments (or initial state) to the _accept callback?

gen_tcp_server:start_link(Module, Port, Args, Options).
handle_accept(Socket, Args) -> {ok, State} | {stop, Reason}.

@useronym
Copy link
Contributor Author

useronym commented Apr 7, 2015

Ah yes, you're right, that would be better (it's our current solution, even).
I'll clean it up and submit a pull request :)

By the way, I'm trying to get gen_tcp_server into the awesome-erlang bookmarks: drobakowski/awesome-erlang#28

Cheers

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

No branches or pull requests

2 participants