Skip to content

Commit fd8d703

Browse files
committed
---
yaml --- r: 28626 b: refs/heads/try c: c946f65 h: refs/heads/master v: v3
1 parent dd9d6d4 commit fd8d703

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
5-
refs/heads/try: 2792071bd24848da43f0daa008d661e8f06b8690
5+
refs/heads/try: c946f65d41550168da1d9d5fa97c93d053eed476
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df

branches/try/src/libstd/net_tcp.rs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ enum TcpConnectErrData {
128128
* the remote host. In the event of failure, a
129129
* `net::tcp::tcp_connect_err_data` instance will be returned
130130
*/
131-
fn connect(-input_ip: ip::IpAddr, port: uint,
131+
fn connect(+input_ip: ip::IpAddr, port: uint,
132132
iotask: IoTask)
133133
-> result::Result<TcpSocket, TcpConnectErrData> unsafe {
134134
let result_po = core::comm::Port::<ConnAttempt>();
@@ -261,7 +261,7 @@ fn connect(-input_ip: ip::IpAddr, port: uint,
261261
* A `result` object with a `nil` value as the `ok` variant, or a
262262
* `tcp_err_data` value as the `err` variant
263263
*/
264-
fn write(sock: TcpSocket, raw_write_data: ~[u8])
264+
fn write(sock: &TcpSocket, raw_write_data: ~[u8])
265265
-> result::Result<(), TcpErrData> unsafe {
266266
let socket_data_ptr = ptr::addr_of(*(sock.socket_data));
267267
write_common_impl(socket_data_ptr, raw_write_data)
@@ -298,7 +298,7 @@ fn write(sock: TcpSocket, raw_write_data: ~[u8])
298298
* `result` object with a `nil` value as the `ok` variant, or a `tcp_err_data`
299299
* value as the `err` variant
300300
*/
301-
fn write_future(sock: TcpSocket, raw_write_data: ~[u8])
301+
fn write_future(sock: &TcpSocket, raw_write_data: ~[u8])
302302
-> future::Future<result::Result<(), TcpErrData>> unsafe {
303303
let socket_data_ptr = ptr::addr_of(*(sock.socket_data));
304304
do future_spawn {
@@ -322,7 +322,7 @@ fn write_future(sock: TcpSocket, raw_write_data: ~[u8])
322322
* optionally, loop on) from until `read_stop` is called, or a
323323
* `tcp_err_data` record
324324
*/
325-
fn read_start(sock: TcpSocket)
325+
fn read_start(sock: &TcpSocket)
326326
-> result::Result<comm::Port<
327327
result::Result<~[u8], TcpErrData>>, TcpErrData> unsafe {
328328
let socket_data = ptr::addr_of(*(sock.socket_data));
@@ -336,8 +336,8 @@ fn read_start(sock: TcpSocket)
336336
*
337337
* * `sock` - a `net::tcp::tcp_socket` that you wish to stop reading on
338338
*/
339-
fn read_stop(sock: TcpSocket,
340-
-read_port: comm::Port<result::Result<~[u8], TcpErrData>>) ->
339+
fn read_stop(sock: &TcpSocket,
340+
+read_port: comm::Port<result::Result<~[u8], TcpErrData>>) ->
341341
result::Result<(), TcpErrData> unsafe {
342342
log(debug, fmt!("taking the read_port out of commission %?", read_port));
343343
let socket_data = ptr::addr_of(*sock.socket_data);
@@ -359,7 +359,7 @@ fn read_stop(sock: TcpSocket,
359359
* * `timeout_msecs` - a `uint` value, in msecs, to wait before dropping the
360360
* read attempt. Pass `0u` to wait indefinitely
361361
*/
362-
fn read(sock: TcpSocket, timeout_msecs: uint)
362+
fn read(sock: &TcpSocket, timeout_msecs: uint)
363363
-> result::Result<~[u8],TcpErrData> {
364364
let socket_data = ptr::addr_of(*(sock.socket_data));
365365
read_common_impl(socket_data, timeout_msecs)
@@ -394,7 +394,7 @@ fn read(sock: TcpSocket, timeout_msecs: uint)
394394
* * `timeout_msecs` - a `uint` value, in msecs, to wait before dropping the
395395
* read attempt. Pass `0u` to wait indefinitely
396396
*/
397-
fn read_future(sock: TcpSocket, timeout_msecs: uint)
397+
fn read_future(sock: &TcpSocket, timeout_msecs: uint)
398398
-> future::Future<result::Result<~[u8],TcpErrData>> {
399399
let socket_data = ptr::addr_of(*(sock.socket_data));
400400
do future_spawn {
@@ -569,9 +569,9 @@ fn accept(new_conn: TcpNewConnection)
569569
* successful/normal shutdown, and a `tcp_listen_err_data` enum in the event
570570
* of listen exiting because of an error
571571
*/
572-
fn listen(-host_ip: ip::IpAddr, port: uint, backlog: uint,
572+
fn listen(+host_ip: ip::IpAddr, port: uint, backlog: uint,
573573
iotask: IoTask,
574-
on_establish_cb: fn~(comm::Chan<Option<TcpErrData>>),
574+
+on_establish_cb: fn~(comm::Chan<Option<TcpErrData>>),
575575
+new_connect_cb: fn~(TcpNewConnection,
576576
comm::Chan<Option<TcpErrData>>))
577577
-> result::Result<(), TcpListenErrData> unsafe {
@@ -586,10 +586,10 @@ fn listen(-host_ip: ip::IpAddr, port: uint, backlog: uint,
586586
}
587587
}
588588

589-
fn listen_common(-host_ip: ip::IpAddr, port: uint, backlog: uint,
589+
fn listen_common(+host_ip: ip::IpAddr, port: uint, backlog: uint,
590590
iotask: IoTask,
591-
on_establish_cb: fn~(comm::Chan<Option<TcpErrData>>),
592-
-on_connect_cb: fn~(*uv::ll::uv_tcp_t))
591+
+on_establish_cb: fn~(comm::Chan<Option<TcpErrData>>),
592+
+on_connect_cb: fn~(*uv::ll::uv_tcp_t))
593593
-> result::Result<(), TcpListenErrData> unsafe {
594594
let stream_closed_po = core::comm::Port::<()>();
595595
let kill_po = core::comm::Port::<Option<TcpErrData>>();
@@ -726,36 +726,36 @@ fn listen_common(-host_ip: ip::IpAddr, port: uint, backlog: uint,
726726
*
727727
* A buffered wrapper that you can cast as an `io::reader` or `io::writer`
728728
*/
729-
fn socket_buf(-sock: TcpSocket) -> TcpSocketBuf {
729+
fn socket_buf(+sock: TcpSocket) -> TcpSocketBuf {
730730
TcpSocketBuf(@{ sock: move sock, mut buf: ~[] })
731731
}
732732

733733
/// Convenience methods extending `net::tcp::tcp_socket`
734734
impl TcpSocket {
735735
fn read_start() -> result::Result<comm::Port<
736736
result::Result<~[u8], TcpErrData>>, TcpErrData> {
737-
read_start(self)
737+
read_start(&self)
738738
}
739739
fn read_stop(-read_port:
740740
comm::Port<result::Result<~[u8], TcpErrData>>) ->
741741
result::Result<(), TcpErrData> {
742-
read_stop(self, move read_port)
742+
read_stop(&self, move read_port)
743743
}
744744
fn read(timeout_msecs: uint) ->
745745
result::Result<~[u8], TcpErrData> {
746-
read(self, timeout_msecs)
746+
read(&self, timeout_msecs)
747747
}
748748
fn read_future(timeout_msecs: uint) ->
749749
future::Future<result::Result<~[u8], TcpErrData>> {
750-
read_future(self, timeout_msecs)
750+
read_future(&self, timeout_msecs)
751751
}
752752
fn write(raw_write_data: ~[u8])
753753
-> result::Result<(), TcpErrData> {
754-
write(self, raw_write_data)
754+
write(&self, raw_write_data)
755755
}
756756
fn write_future(raw_write_data: ~[u8])
757757
-> future::Future<result::Result<(), TcpErrData>> {
758-
write_future(self, raw_write_data)
758+
write_future(&self, raw_write_data)
759759
}
760760
}
761761

@@ -764,7 +764,7 @@ impl TcpSocketBuf: io::Reader {
764764
fn read(buf: &[mut u8], len: uint) -> uint {
765765
// Loop until our buffer has enough data in it for us to read from.
766766
while self.data.buf.len() < len {
767-
let read_result = read(self.data.sock, 0u);
767+
let read_result = read(&self.data.sock, 0u);
768768
if read_result.is_err() {
769769
let err_data = read_result.get_err();
770770

@@ -1112,7 +1112,7 @@ extern fn on_tcp_read_cb(stream: *uv::ll::uv_stream_t,
11121112
}
11131113

11141114
extern fn on_alloc_cb(handle: *libc::c_void,
1115-
++suggested_size: size_t)
1115+
suggested_size: size_t)
11161116
-> uv::ll::uv_buf_t unsafe {
11171117
log(debug, ~"tcp read on_alloc_cb!");
11181118
let char_ptr = uv::ll::malloc_buf_base_of(suggested_size);
@@ -1470,7 +1470,7 @@ mod test {
14701470
*/
14711471
}
14721472

1473-
fn buf_write<W:io::Writer>(+w: &W, val: ~str) {
1473+
fn buf_write<W:io::Writer>(+w: &W, val: &str) {
14741474
log(debug, fmt!("BUF_WRITE: val len %?", str::len(val)));
14751475
do str::byte_slice(val) |b_slice| {
14761476
log(debug, fmt!("BUF_WRITE: b_slice len %?",
@@ -1486,7 +1486,7 @@ mod test {
14861486
str::from_bytes(new_bytes)
14871487
}
14881488

1489-
fn run_tcp_test_server(server_ip: ~str, server_port: uint, resp: ~str,
1489+
fn run_tcp_test_server(server_ip: &str, server_port: uint, +resp: ~str,
14901490
server_ch: comm::Chan<~str>,
14911491
cont_ch: comm::Chan<()>,
14921492
iotask: IoTask) -> ~str {
@@ -1524,7 +1524,7 @@ mod test {
15241524
let sock = result::unwrap(move accept_result);
15251525
log(debug, ~"SERVER: successfully accepted"+
15261526
~"connection!");
1527-
let received_req_bytes = read(sock, 0u);
1527+
let received_req_bytes = read(&sock, 0u);
15281528
match received_req_bytes {
15291529
result::Ok(data) => {
15301530
log(debug, ~"SERVER: got REQ str::from_bytes..");
@@ -1533,7 +1533,7 @@ mod test {
15331533
server_ch.send(
15341534
str::from_bytes(data));
15351535
log(debug, ~"SERVER: before write");
1536-
tcp_write_single(sock, str::to_bytes(resp));
1536+
tcp_write_single(&sock, str::to_bytes(resp));
15371537
log(debug, ~"SERVER: after write.. die");
15381538
core::comm::send(kill_ch, None);
15391539
}
@@ -1572,7 +1572,7 @@ mod test {
15721572
ret_val
15731573
}
15741574

1575-
fn run_tcp_test_server_fail(server_ip: ~str, server_port: uint,
1575+
fn run_tcp_test_server_fail(server_ip: &str, server_port: uint,
15761576
iotask: IoTask) -> TcpListenErrData {
15771577
let server_ip_addr = ip::v4::parse_addr(server_ip);
15781578
let listen_result = listen(move server_ip_addr, server_port, 128,
@@ -1595,7 +1595,7 @@ mod test {
15951595
}
15961596
}
15971597

1598-
fn run_tcp_test_client(server_ip: ~str, server_port: uint, resp: ~str,
1598+
fn run_tcp_test_client(server_ip: &str, server_port: uint, resp: &str,
15991599
client_ch: comm::Chan<~str>,
16001600
iotask: IoTask) -> result::Result<~str,
16011601
TcpConnectErrData> {
@@ -1612,7 +1612,7 @@ mod test {
16121612
else {
16131613
let sock = result::unwrap(move connect_result);
16141614
let resp_bytes = str::to_bytes(resp);
1615-
tcp_write_single(sock, resp_bytes);
1615+
tcp_write_single(&sock, resp_bytes);
16161616
let read_result = sock.read(0u);
16171617
if read_result.is_err() {
16181618
log(debug, ~"CLIENT: failure to read");
@@ -1628,7 +1628,7 @@ mod test {
16281628
}
16291629
}
16301630

1631-
fn tcp_write_single(sock: TcpSocket, val: ~[u8]) {
1631+
fn tcp_write_single(sock: &TcpSocket, val: ~[u8]) {
16321632
let write_result_future = sock.write_future(val);
16331633
let write_result = write_result_future.get();
16341634
if result::is_err(write_result) {

0 commit comments

Comments
 (0)