fix a multiline comment warning
[folly.git] / folly / SocketAddress.h
index 31d441f7ed26e471b45efd7cc03d77f64dfb07df..bfa5042cdbc8a025d274deecf88ecd1f9e6588a4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 Facebook, Inc.
+ * Copyright 2014-present Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -306,6 +306,19 @@ class SocketAddress {
     setFromPath(StringPiece{path, length});
   }
 
+  /**
+   * Construct a SocketAddress from a local unix socket path.
+   *
+   * Raises std::invalid_argument on error.
+   *
+   * @param path The Unix domain socket path.
+   */
+  static SocketAddress makeFromPath(StringPiece path) {
+    SocketAddress addr;
+    addr.setFromPath(path);
+    return addr;
+  }
+
   /**
    * Initialize this SocketAddress from a socket's peer address.
    *
@@ -600,7 +613,7 @@ class SocketAddress {
 size_t hash_value(const SocketAddress& address);
 
 std::ostream& operator<<(std::ostream& os, const SocketAddress& addr);
-}
+} // namespace folly
 
 namespace std {
 
@@ -611,4 +624,4 @@ struct hash<folly::SocketAddress> {
     return addr.hash();
   }
 };
-}
+} // namespace std