{"action":"closed","issue":{"url":"https://api.github.com/repos/jstasiak/python-zeroconf/issues/47","repository_url":"https://api.github.com/repos/jstasiak/python-zeroconf","labels_url":"https://api.github.com/repos/jstasiak/python-zeroconf/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/jstasiak/python-zeroconf/issues/47/comments","events_url":"https://api.github.com/repos/jstasiak/python-zeroconf/issues/47/events","html_url":"https://github.com/jstasiak/python-zeroconf/issues/47","id":142126665,"number":47,"title":"call register_service twice, it will crash","user":{"login":"sprhawk","id":465558,"avatar_url":"https://avatars.githubusercontent.com/u/465558?v=3","gravatar_id":"","url":"https://api.github.com/users/sprhawk","html_url":"https://github.com/sprhawk","followers_url":"https://api.github.com/users/sprhawk/followers","following_url":"https://api.github.com/users/sprhawk/following{/other_user}","gists_url":"https://api.github.com/users/sprhawk/gists{/gist_id}","starred_url":"https://api.github.com/users/sprhawk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sprhawk/subscriptions","organizations_url":"https://api.github.com/users/sprhawk/orgs","repos_url":"https://api.github.com/users/sprhawk/repos","events_url":"https://api.github.com/users/sprhawk/events{/privacy}","received_events_url":"https://api.github.com/users/sprhawk/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-03-20T04:03:35Z","updated_at":"2016-06-26T23:12:42Z","closed_at":"2016-06-26T23:12:42Z","body":"```\r\n\r\nTYPE = \"_motion._tcp.local.\"\r\nNAME = \"_yyyyXXXX.\" + TYPE\r\nPORT = 4321\r\n\r\nzeroconf = Zeroconf()\r\n\r\ndef reg_srv():\r\n    socket_addr = socket.gethostbyname(socket.gethostname())\r\n    info = ServiceInfo(TYPE,\r\n            NAME,\r\n            socket.inet_aton(socket_addr), PORT, 0, 0,\r\n            {\"desc\":\"HOME Bonjour test\"})\r\n\r\n\r\n    zeroconf.register_service(info)\r\n\r\n    print(\"broadcasting: \" + socket_addr + \" :\" + str(PORT))\r\n\r\ndef main():\r\n    reg_srv()\r\n    print(\"listening on 4321 ...\\n\")\r\n\r\n    reactor.listenTCP(4321, MotionServiceFactory())\r\n    reactor.run()\r\n    print(\"closing zeroconf\")\r\n    zeroconf.close()\r\n\r\n```\r\n\r\nwhen I called main() twice, it will crash:\r\n\r\n```shell\r\nmotion_server.py in reg_srv()\r\n     25\r\n     26\r\n---> 27     zeroconf.register_service(info)\r\n     28\r\n     29     print(\"broadcasting: \" + socket_addr + \" :\" + str(PORT))\r\n\r\n/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/zeroconf-0.17.4-py3.4.egg/zeroconf.py in register_service(self, info, ttl)\r\n   1430         information for that service.  The name of the service may be\r\n   1431         changed if needed to make it unique on the network.\"\"\"\r\n-> 1432         self.check_service(info)\r\n   1433         self.services[info.name.lower()] = info\r\n   1434         if info.type in self.servicetypes:\r\n\r\n/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/zeroconf-0.17.4-py3.4.egg/zeroconf.py in check_service(self, info)\r\n   1546             out.add_authorative_answer(DNSPointer(info.type, _TYPE_PTR,\r\n   1547                                                   _CLASS_IN, _DNS_TTL, info.name))\r\n-> 1548             self.send(out)\r\n   1549             i += 1\r\n   1550             next_time += _CHECK_TIME\r\n\r\n/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/zeroconf-0.17.4-py3.4.egg/zeroconf.py in send(self, out, addr, port)\r\n   1666         log.debug('Sending %r as %r...', out, packet)\r\n   1667         for s in self._respond_sockets:\r\n-> 1668             bytes_sent = s.sendto(packet, 0, (addr, port))\r\n   1669             if bytes_sent != len(packet):\r\n   1670                 raise Error(\r\n\r\nOSError: [Errno 9] Bad file descriptor\r\n```"}}
{"actor":{"display_login":"stephenrauch"}}