Skip to content

Commit 67ee480

Browse files
committed
native: Remove unused and untested UnixDatagram
1 parent b553944 commit 67ee480

File tree

1 file changed

+0
-71
lines changed

1 file changed

+0
-71
lines changed

src/libnative/io/pipe_unix.rs

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -155,77 +155,6 @@ impl rtio::RtioPipe for UnixStream {
155155
}
156156
}
157157

158-
////////////////////////////////////////////////////////////////////////////////
159-
// Unix Datagram
160-
////////////////////////////////////////////////////////////////////////////////
161-
162-
pub struct UnixDatagram {
163-
inner: UnsafeArc<Inner>,
164-
}
165-
166-
impl UnixDatagram {
167-
pub fn connect(addr: &CString) -> IoResult<UnixDatagram> {
168-
connect(addr, libc::SOCK_DGRAM).map(|inner| {
169-
UnixDatagram { inner: UnsafeArc::new(inner) }
170-
})
171-
}
172-
173-
pub fn bind(addr: &CString) -> IoResult<UnixDatagram> {
174-
bind(addr, libc::SOCK_DGRAM).map(|inner| {
175-
UnixDatagram { inner: UnsafeArc::new(inner) }
176-
})
177-
}
178-
179-
fn fd(&self) -> fd_t { unsafe { (*self.inner.get()).fd } }
180-
181-
pub fn recvfrom(&mut self, buf: &mut [u8]) -> IoResult<(uint, CString)> {
182-
let mut storage: libc::sockaddr_storage = unsafe { intrinsics::init() };
183-
let storagep = &mut storage as *mut libc::sockaddr_storage;
184-
let mut addrlen: libc::socklen_t =
185-
mem::size_of::<libc::sockaddr_storage>() as libc::socklen_t;
186-
let ret = retry(|| unsafe {
187-
libc::recvfrom(self.fd(),
188-
buf.as_ptr() as *mut libc::c_void,
189-
buf.len() as libc::size_t,
190-
0,
191-
storagep as *mut libc::sockaddr,
192-
&mut addrlen) as libc::c_int
193-
});
194-
if ret < 0 { return Err(super::last_error()) }
195-
sockaddr_to_unix(&storage, addrlen as uint).and_then(|addr| {
196-
Ok((ret as uint, addr))
197-
})
198-
}
199-
200-
pub fn sendto(&mut self, buf: &[u8], dst: &CString) -> IoResult<()> {
201-
let (dst, len) = try!(addr_to_sockaddr_un(dst));
202-
let dstp = &dst as *libc::sockaddr_storage;
203-
let ret = retry(|| unsafe {
204-
libc::sendto(self.fd(),
205-
buf.as_ptr() as *libc::c_void,
206-
buf.len() as libc::size_t,
207-
0,
208-
dstp as *libc::sockaddr,
209-
len as libc::socklen_t) as libc::c_int
210-
});
211-
match ret {
212-
-1 => Err(super::last_error()),
213-
n if n as uint != buf.len() => {
214-
Err(io::IoError {
215-
kind: io::OtherIoError,
216-
desc: "couldn't send entire packet at once",
217-
detail: None,
218-
})
219-
}
220-
_ => Ok(())
221-
}
222-
}
223-
224-
pub fn clone(&mut self) -> UnixDatagram {
225-
UnixDatagram { inner: self.inner.clone() }
226-
}
227-
}
228-
229158
////////////////////////////////////////////////////////////////////////////////
230159
// Unix Listener
231160
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)