TODO(benh): Remove and defer to Socket::bind.
| 44 | |
| 45 | // TODO(benh): Remove and defer to Socket::bind. |
| 46 | inline Try<Nothing> bind(int_fd s, const Address& address) |
| 47 | { |
| 48 | sockaddr_storage storage = address; |
| 49 | |
| 50 | const socklen_t address_size = static_cast<socklen_t>(address.size()); |
| 51 | if (net::bind(s, (sockaddr*) &storage, address_size) < 0) { |
| 52 | return ErrnoError("Failed to bind on " + stringify(address)); |
| 53 | } |
| 54 | |
| 55 | return Nothing(); |
| 56 | } |
| 57 | |
| 58 | |
| 59 | // TODO(benh): Remove and defer to Socket::connect. |