|
2 | 2 | High-level interface to libuv's TCP functionality
|
3 | 3 | "];
|
4 | 4 |
|
| 5 | +// FIXME: Fewer import *'s |
5 | 6 | import ip = net_ip;
|
6 | 7 | import comm::*;
|
7 | 8 | import result::*;
|
@@ -118,11 +119,11 @@ fn connect(input_ip: ip::ip_addr, port: uint,
|
118 | 119 | log(debug, #fmt("tcp_connect result_ch %?", conn_data.result_ch));
|
119 | 120 | // get an unsafe representation of our stream_handle_ptr that
|
120 | 121 | // we can send into the interact cb to be handled in libuv..
|
121 |
| - log(debug, #fmt("stream_handl_ptr outside interact %?", |
| 122 | + log(debug, #fmt("stream_handle_ptr outside interact %?", |
122 | 123 | stream_handle_ptr));
|
123 | 124 | uv::hl::interact(hl_loop) {|loop_ptr|
|
124 | 125 | log(debug, "in interact cb for tcp client connect..");
|
125 |
| - log(debug, #fmt("stream_handl_ptr in interact %?", |
| 126 | + log(debug, #fmt("stream_handle_ptr in interact %?", |
126 | 127 | stream_handle_ptr));
|
127 | 128 | alt uv::ll::tcp_init( loop_ptr, stream_handle_ptr) {
|
128 | 129 | 0i32 {
|
@@ -191,7 +192,7 @@ fn connect(input_ip: ip::ip_addr, port: uint,
|
191 | 192 | }
|
192 | 193 |
|
193 | 194 | #[doc="
|
194 |
| -Write binary data to a tcp stream; Blocks until operatoin completes |
| 195 | +Write binary data to a tcp stream; Blocks until operation completes |
195 | 196 |
|
196 | 197 | # Arguments
|
197 | 198 |
|
@@ -360,6 +361,8 @@ fn new_listener(host_ip: ip::ip_addr, port: uint, backlog: uint,
|
360 | 361 | let new_conn_po = comm::port::<result::result<*uv::ll::uv_tcp_t,
|
361 | 362 | tcp_err_data>>();
|
362 | 363 | let new_conn_ch = comm::chan(new_conn_po);
|
| 364 | + // FIXME: This shared box should not be captured in the i/o task |
| 365 | + // Make it a unique pointer. |
363 | 366 | let server_data: @tcp_conn_port_data = @{
|
364 | 367 | server_stream: uv::ll::tcp_t(),
|
365 | 368 | stream_closed_po: stream_closed_po,
|
@@ -940,6 +943,10 @@ fn write_common_impl(socket_data_ptr: *tcp_socket_data,
|
940 | 943 | }
|
941 | 944 | }
|
942 | 945 | };
|
| 946 | + // FIXME: Instead of passing unsafe pointers to local data, and waiting |
| 947 | + // here for the write to complete, we should transfer ownership of |
| 948 | + // everything to the I/O task and let it deal with the aftermath, |
| 949 | + // so we don't have to sit here blocking. |
943 | 950 | alt comm::recv(result_po) {
|
944 | 951 | tcp_write_success { result::ok(()) }
|
945 | 952 | tcp_write_error(err_data) { result::err(err_data.to_tcp_err()) }
|
@@ -1181,6 +1188,7 @@ crust fn tcp_write_complete_cb(write_req: *uv::ll::uv_write_t,
|
1181 | 1188 | status: libc::c_int) unsafe {
|
1182 | 1189 | let write_data_ptr = uv::ll::get_data_for_req(write_req)
|
1183 | 1190 | as *write_req_data;
|
| 1191 | + // FIXME: if instead of alt |
1184 | 1192 | alt status {
|
1185 | 1193 | 0i32 {
|
1186 | 1194 | log(debug, "successful write complete");
|
|
0 commit comments