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

ConnectDialog: use qpAddress for address list in ServerItem, and for qhDNSCache. #3018

Closed
wants to merge 1 commit into from

Conversation

mkrautz
Copy link
Contributor

@mkrautz mkrautz commented Apr 10, 2017

This is prepration for the implementation of the ServerResolver class.
(For SRV record resolving.)

foreach(const QHostAddress &qha, qlAddresses)
qsl << Qt::escape(qha.toString());
foreach(const qpAddress &addr, qlAddressPorts)
qsl << Qt::escape(addr.first.toString());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should include the port here.

foreach(const QHostAddress &qha, info.addresses()) {
qpAddress addr(HostAddress(qha), si->usPort);
qpAddress addr(qha, si->usPort);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should not have changed.

…qhDNSCache.

This is prepration for the implementation of the ServerResolver class.
(For SRV record resolving.)

We now store address/port pairs for the DNS cache and list of resolved
addresses in ConnectDialog. This is because SRV records resolve to
address/port pairs.
Copy link
Member

@Kissaki Kissaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Man, that's a lot of interwoven logic. Hard to follow/see. I don't feel like I was able to verify everything surrounding this. Especially the lookups, dns cache and ip cache interaction. But the logic already works, so this seems fine/the changes make sense.

Apart from the variable name, looks good/plausible to me.

@@ -145,7 +145,7 @@ class ServerItem : public QTreeWidgetItem, public PingStats {
QString qsBonjourHost;
BonjourRecord brRecord;

QList<QHostAddress> qlAddresses;
QList<qpAddress> qlAddressPorts;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like the variable name. It's not address ports, it's address including port. Keeping the name address qlAddresses seems better to me. That also matches the type name, but pluralized, indicating naming consistency. (A port is part of the address.)

@@ -145,7 +145,7 @@ class ServerItem : public QTreeWidgetItem, public PingStats {
QString qsBonjourHost;
BonjourRecord brRecord;

QList<QHostAddress> qlAddresses;
QList<qpAddress> qlAddressPorts;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class ServerItem has qsHostname and usPort. So what is qlAddressPorts even? Should have a describing comment.

Contains (DNS-)resolved addresses derived from qsHostname and usPort (IPv4 and IPv6).

si->qlAddresses.append(qha);
else
si->qlAddresses = qhDNSCache.value(host);
if (! qha.isNull()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to see a comment here. We check if it's an IP (rather than a hostname/domain) and use that if it is.
Or should I have known QHostAddress is for IP addresses (only)?

if (! qha.isNull()) {
si->qlAddressPorts.append(qpAddress(HostAddress(qha), si->usPort));
} else {
si->qlAddressPorts = qhDNSCache.value(host);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we know we have something in the cache?

@mkrautz mkrautz closed this Jun 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants