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
Failed to connect, retrying in 5.0s #334
Comments
Can affirm. I initially thought it was a firewall issue (this laptop has a strict set of ports) and opened them with no dice. After installing |
Outa sight man -- worked for me too -- THANX for the dope on this! |
So what is the difference between zeroconf 0.24.3 (works) and 0.24.4 (does not work) and what would need to be changed to mkchromecast to work with the newest version? |
diff --git a/README.rst b/README.rst
index aae1124..432d3c4 100644
--- a/README.rst
+++ b/README.rst
@@ -134,6 +134,12 @@ See examples directory for more.
Changelog
=========
+0.24.4
+------
+
+* Fixed resetting TTL in DNSRecord.reset_ttl(), thanks to Matt Saxon
+* Improved various DNS class' string representations, thanks to Jay Hogg
+
0.24.3
------
diff --git a/zeroconf/__init__.py b/zeroconf/__init__.py
index 6c9d55d..35fac80 100644
--- a/zeroconf/__init__.py
+++ b/zeroconf/__init__.py
@@ -42,7 +42,7 @@ import ifaddr
__author__ = 'Paul Scott-Murphy, William McBrine'
__maintainer__ = 'Jakub Stasiak <jakub@stasiak.at>'
-__version__ = '0.24.3'
+__version__ = '0.24.4'
__license__ = 'LGPL'
@@ -420,7 +420,7 @@ class DNSEntry:
result += ","
result += self.name
if other is not None:
- result += ",%s]" % cast(Any, other)
+ result += "]=%s" % cast(Any, other)
else:
result += "]"
return result
@@ -502,6 +502,8 @@ class DNSRecord(DNSEntry):
another record."""
self.created = other.created
self.ttl = other.ttl
+ self._expiration_time = self.get_expiration_time(100)
+ self._stale_time = self.get_expiration_time(50)
def write(self, out: 'DNSOutgoing') -> None:
"""Abstract method"""
@@ -509,7 +511,7 @@ class DNSRecord(DNSEntry):
def to_string(self, other: Union[bytes, str]) -> str:
"""String representation with additional information"""
- arg = "%s/%s,%s" % (self.ttl, self.get_remaining_ttl(current_time_millis()), cast(Any, other))
+ arg = "%s/%s,%s" % (self.ttl, int(self.get_remaining_ttl(current_time_millis())), cast(Any, other))
return DNSEntry.entry_to_string(self, "record", arg)
@@ -538,9 +540,9 @@ class DNSAddress(DNSRecord):
def __repr__(self) -> str:
"""String representation"""
try:
- return str(socket.inet_ntoa(self.address))
+ return self.to_string(str(socket.inet_ntoa(self.address)))
except Exception: # TODO stop catching all Exceptions
- return str(self.address)
+ return self.to_string(str(self.address))
class DNSHinfo(DNSRecord):
@@ -580,7 +582,7 @@ class DNSHinfo(DNSRecord):
def __repr__(self) -> str:
"""String representation"""
- return self.cpu + " " + self.os
+ return self.to_string(self.cpu + " " + self.os)
class DNSPointer(DNSRecord):
diff --git a/zeroconf/test.py b/zeroconf/test.py
index f0d5ad4..5a89c9f 100644
--- a/zeroconf/test.py
+++ b/zeroconf/test.py
@@ -79,6 +79,21 @@ class TestDunder(unittest.TestCase):
self.assertRaises(r.AbstractMethodException, record.__eq__, record)
self.assertRaises(r.AbstractMethodException, record.write, None)
+ def test_dns_record_reset_ttl(self):
+ record = r.DNSRecord('irrelevant', r._TYPE_SRV, r._CLASS_IN, r._DNS_HOST_TTL)
+ time.sleep(1)
+ record2 = r.DNSRecord('irrelevant', r._TYPE_SRV, r._CLASS_IN, r._DNS_HOST_TTL)
+ now = r.current_time_millis()
+
+ assert record.created != record2.created
+ assert record.get_remaining_ttl(now) != record2.get_remaining_ttl(now)
+
+ record.reset_ttl(record2)
+
+ assert record.ttl == record2.ttl
+ assert record.created == record2.created
+ assert record.get_remaining_ttl(now) == record2.get_remaining_ttl(now)
+
def test_service_info_dunder(self):
type_ = "_test-srvc-type._tcp.local."
name = "xxxyyy" |
Affects Ubuntu 20.04 mkchromecast installed via apt, it seems. |
Yes, I arrived here because of this error on ubuntu 20.04. |
FWIW, this fix worked for me. I had 0.24.4 installed by default on Ubuntu 20.04; rolling back to 0.24.3 and it's working perfectly. :) |
I think this is the change in that diff that caused the issue. I haven't taken the time yet to figure out exactly what this does, but if I change only that line in my local |
This also did the trick for me on Ubuntu 20.04.3. |
Trying to run mkchromecast on Linux Mint 20, but this is what happens. I run, i open pavucontrol, and pipe the music to the mkchromecast sink, but no sound comes out... Here is what it says in the terminal.
*Edit: After searching and finding others w/ the same issue. I did this:
apt install python3-pip
then
pip3 install zeroconf==0.24.3
now it works.
The text was updated successfully, but these errors were encountered: