|
13 | 13 | #![stable(feature = "rust1", since = "1.0.0")]
|
14 | 14 |
|
15 | 15 | use fs;
|
| 16 | +use net; |
16 | 17 | use sys;
|
17 |
| -use sys_common::{AsInner, FromInner, IntoInner}; |
| 18 | +use sys_common::{self, AsInner, FromInner, IntoInner}; |
18 | 19 |
|
19 | 20 | /// Raw file descriptors.
|
20 | 21 | #[stable(feature = "rust1", since = "1.0.0")]
|
@@ -89,58 +90,62 @@ impl IntoRawFd for fs::File {
|
89 | 90 | }
|
90 | 91 | }
|
91 | 92 |
|
92 |
| -/* |
93 | 93 | #[stable(feature = "rust1", since = "1.0.0")]
|
94 | 94 | impl AsRawFd for net::TcpStream {
|
95 |
| - fn as_raw_fd(&self) -> RawFd { *self.as_inner().socket().as_inner() } |
| 95 | + fn as_raw_fd(&self) -> RawFd { |
| 96 | + self.as_inner().as_inner().fd().raw() |
| 97 | + } |
96 | 98 | }
|
97 | 99 | #[stable(feature = "rust1", since = "1.0.0")]
|
98 | 100 | impl AsRawFd for net::TcpListener {
|
99 |
| - fn as_raw_fd(&self) -> RawFd { *self.as_inner().socket().as_inner() } |
| 101 | + fn as_raw_fd(&self) -> RawFd { |
| 102 | + self.as_inner().as_inner().fd().raw() |
| 103 | + } |
100 | 104 | }
|
101 | 105 | #[stable(feature = "rust1", since = "1.0.0")]
|
102 | 106 | impl AsRawFd for net::UdpSocket {
|
103 |
| - fn as_raw_fd(&self) -> RawFd { *self.as_inner().socket().as_inner() } |
| 107 | + fn as_raw_fd(&self) -> RawFd { |
| 108 | + self.as_inner().as_inner().fd().raw() |
| 109 | + } |
104 | 110 | }
|
105 | 111 |
|
106 | 112 | #[stable(feature = "from_raw_os", since = "1.1.0")]
|
107 | 113 | impl FromRawFd for net::TcpStream {
|
108 | 114 | unsafe fn from_raw_fd(fd: RawFd) -> net::TcpStream {
|
109 |
| - let socket = sys::net::Socket::from_inner(fd); |
110 |
| - net::TcpStream::from_inner(sys_common::net::TcpStream::from_inner(socket)) |
| 115 | + let file = sys::fs::File::from_inner(fd); |
| 116 | + net::TcpStream::from_inner(sys_common::net::TcpStream::from_inner(file)) |
111 | 117 | }
|
112 | 118 | }
|
113 | 119 | #[stable(feature = "from_raw_os", since = "1.1.0")]
|
114 | 120 | impl FromRawFd for net::TcpListener {
|
115 | 121 | unsafe fn from_raw_fd(fd: RawFd) -> net::TcpListener {
|
116 |
| - let socket = sys::net::Socket::from_inner(fd); |
117 |
| - net::TcpListener::from_inner(sys_common::net::TcpListener::from_inner(socket)) |
| 122 | + let file = sys::fs::File::from_inner(fd); |
| 123 | + net::TcpListener::from_inner(sys_common::net::TcpListener::from_inner(file)) |
118 | 124 | }
|
119 | 125 | }
|
120 | 126 | #[stable(feature = "from_raw_os", since = "1.1.0")]
|
121 | 127 | impl FromRawFd for net::UdpSocket {
|
122 | 128 | unsafe fn from_raw_fd(fd: RawFd) -> net::UdpSocket {
|
123 |
| - let socket = sys::net::Socket::from_inner(fd); |
124 |
| - net::UdpSocket::from_inner(sys_common::net::UdpSocket::from_inner(socket)) |
| 129 | + let file = sys::fs::File::from_inner(fd); |
| 130 | + net::UdpSocket::from_inner(sys_common::net::UdpSocket::from_inner(file)) |
125 | 131 | }
|
126 | 132 | }
|
127 | 133 |
|
128 | 134 | #[stable(feature = "into_raw_os", since = "1.4.0")]
|
129 | 135 | impl IntoRawFd for net::TcpStream {
|
130 | 136 | fn into_raw_fd(self) -> RawFd {
|
131 |
| - self.into_inner().into_socket().into_inner() |
| 137 | + self.into_inner().into_inner().into_fd().into_raw() |
132 | 138 | }
|
133 | 139 | }
|
134 | 140 | #[stable(feature = "into_raw_os", since = "1.4.0")]
|
135 | 141 | impl IntoRawFd for net::TcpListener {
|
136 | 142 | fn into_raw_fd(self) -> RawFd {
|
137 |
| - self.into_inner().into_socket().into_inner() |
| 143 | + self.into_inner().into_inner().into_fd().into_raw() |
138 | 144 | }
|
139 | 145 | }
|
140 | 146 | #[stable(feature = "into_raw_os", since = "1.4.0")]
|
141 | 147 | impl IntoRawFd for net::UdpSocket {
|
142 | 148 | fn into_raw_fd(self) -> RawFd {
|
143 |
| - self.into_inner().into_socket().into_inner() |
| 149 | + self.into_inner().into_inner().into_fd().into_raw() |
144 | 150 | }
|
145 | 151 | }
|
146 |
| -*/ |
|
0 commit comments