Skip to content

Instantly share code, notes, and snippets.

@gleber
Created November 21, 2011 19:51
Show Gist options
  • Save gleber/1383723 to your computer and use it in GitHub Desktop.
Save gleber/1383723 to your computer and use it in GitHub Desktop.
dnssd_erlang segfault
while true; do
avahi-publish -s test@b _http._tcp 7778 &
sleep 3s
killall avahi-publish
sleep 1s
killall avahi-publish
done
-module(dnssd_crash).
-compile(export_all).
-include_lib("stdlib/include/ms_transform.hrl").
t(Mod) ->
dbg:tracer(),
dbg:p(all, [call]),
dbg:tpl([Mod], dbg:fun2ms(fun(_) -> return_trace() end)).
test() ->
t:t(dnssd), %% without this
dnssd:start(),
spawn(fun() ->
dnssd:register("test@a", "_http._tcp", 7779, []),
dnssd:browse("_http._tcp"),
loop()
end).
loop() ->
receive
{dnssd, _Ref, {browse, Op, {Name, Type, Domain}}} = Msg ->
dnssd:resolve_sync(Name, Type, Domain),
loop()
after
30000 ->
ok
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment