Skip to content

Commit

Permalink
Fix concerns
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaka committed Oct 29, 2018
1 parent 185645f commit 183e4eb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
13 changes: 8 additions & 5 deletions misc/mdns/src/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

//! Contains methods that handle the DNS encoding and decoding capabilities not available in the
//! `dns_parser` library.
use data_encoding;
use libp2p_core::{Multiaddr, PeerId};
use rand;
Expand Down Expand Up @@ -67,8 +70,8 @@ pub fn build_query() -> Vec<u8> {
append_qname(&mut out, SERVICE_NAME);

// Flags.
append_u16(&mut out, 0xc);
append_u16(&mut out, 0x1);
append_u16(&mut out, 0x0c);
append_u16(&mut out, 0x01);

// Since the output is constant, we reserve the right amount ahead of time.
// If this assert fails, adjust the capacity of `out` in the source code.
Expand Down Expand Up @@ -109,7 +112,7 @@ pub fn build_query_response(

// Flags.
out.push(0x00);
out.push(0x0c);
out.push(0x0c); // PTR record.
out.push(0x80);
out.push(0x01);

Expand Down Expand Up @@ -168,7 +171,7 @@ pub fn build_service_discovery_response(id: u16, ttl: Duration) -> Vec<u8> {

// Flags.
out.push(0x00);
out.push(0x0c);
out.push(0x0c); // PTR record requested.
out.push(0x80);
out.push(0x01);

Expand Down Expand Up @@ -277,7 +280,7 @@ fn append_txt_record<'a>(

// Flags.
out.push(0x00);
out.push(0x10);
out.push(0x10); // TXT record.
out.push(0x80);
out.push(0x01);

Expand Down
4 changes: 2 additions & 2 deletions misc/mdns/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ impl MdnsService {
pub enum MdnsPacket<'a> {
/// A query made by a remote.
Query(MdnsQuery<'a>),
/// A response received by a remote to one of our queries.
/// A response sent by a remote in response to one of our queries.
Response(MdnsResponse<'a>),
/// A request for service discovery.
ServiceDiscovery(MdnsServiceDiscovery<'a>),
Expand All @@ -311,7 +311,7 @@ impl<'a> MdnsQuery<'a> {
///
/// Pass the ID of the local peer, and the list o addresses we're listening on.
///
/// If there are more than 2^16-1 addresses, ignores the other.
/// If there are more than 2^16-1 addresses, ignores the others.
///
/// > **Note**: Keep in mind that we will also receive this response in an `MdnsResponse`.
#[inline]
Expand Down

0 comments on commit 183e4eb

Please sign in to comment.