Skip to content

Commit ac7604c

Browse files
committed
---
yaml --- r: 152347 b: refs/heads/try2 c: 51348b0 h: refs/heads/master i: 152345: 0cf5417 152343: f4b6fd4 v: v3
1 parent cf6cb93 commit ac7604c

File tree

11 files changed

+314
-319
lines changed

11 files changed

+314
-319
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: da2293c6f6ea9291749f51a4608d50585be835f0
8+
refs/heads/try2: 51348b068b88d71426d9de93762575cd2bb9a5f5
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libnative/io/addrinfo.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,23 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use ai = std::io::net::addrinfo;
1211
use libc::{c_char, c_int};
1312
use libc;
1413
use std::c_str::CString;
15-
use std::io::IoError;
1614
use std::mem;
1715
use std::ptr::{null, mut_null};
16+
use std::rt::rtio;
17+
use std::rt::rtio::IoError;
1818

19-
use super::net::sockaddr_to_addr;
19+
use super::net;
2020

2121
pub struct GetAddrInfoRequest;
2222

2323
impl GetAddrInfoRequest {
2424
pub fn run(host: Option<&str>, servname: Option<&str>,
25-
hint: Option<ai::Hint>) -> Result<Vec<ai::Info>, IoError> {
25+
hint: Option<rtio::AddrinfoHint>)
26+
-> Result<Vec<rtio::AddrinfoInfo>, IoError>
27+
{
2628
assert!(host.is_some() || servname.is_some());
2729

2830
let c_host = host.map_or(unsafe { CString::new(null(), true) }, |x| x.to_c_str());
@@ -61,16 +63,16 @@ impl GetAddrInfoRequest {
6163
let mut rp = res;
6264
while rp.is_not_null() {
6365
unsafe {
64-
let addr = match sockaddr_to_addr(mem::transmute((*rp).ai_addr),
65-
(*rp).ai_addrlen as uint) {
66+
let addr = match net::sockaddr_to_addr(mem::transmute((*rp).ai_addr),
67+
(*rp).ai_addrlen as uint) {
6668
Ok(a) => a,
6769
Err(e) => return Err(e)
6870
};
69-
addrs.push(ai::Info {
71+
addrs.push(rtio::AddrinfoInfo {
7072
address: addr,
7173
family: (*rp).ai_family as uint,
72-
socktype: None,
73-
protocol: None,
74+
socktype: 0,
75+
protocol: 0,
7476
flags: (*rp).ai_flags as uint
7577
});
7678

@@ -96,21 +98,18 @@ extern "system" {
9698

9799
#[cfg(windows)]
98100
fn get_error(_: c_int) -> IoError {
99-
unsafe {
100-
IoError::from_errno(WSAGetLastError() as uint, true)
101-
}
101+
net::last_error()
102102
}
103103

104104
#[cfg(not(windows))]
105105
fn get_error(s: c_int) -> IoError {
106-
use std::io;
107106

108107
let err_str = unsafe {
109108
CString::new(gai_strerror(s), false).as_str().unwrap().to_string()
110109
};
111110
IoError {
112-
kind: io::OtherIoError,
113-
desc: "unable to resolve host",
111+
code: s as uint,
112+
extra: 0,
114113
detail: Some(err_str),
115114
}
116115
}

0 commit comments

Comments
 (0)