about summary refs log tree commit diff
path: root/src/libstd/rt/uv/uvio.rs
AgeCommit message (Collapse)AuthorLines
2013-09-06auto merge of #9000 : brson/rust/dns, r=anasazibors-1/+33
This exposes a very simple function for resolving host names. There's a lot more that needs to be done, but this is probably enough for servo to get started connecting to real websites again.
2013-09-05std::rt: Add get_host_addresses functionBrian Anderson-1/+33
This is a very simplistic method for host name resolution. It converts a host name to a vector of IP addresses. Should be enough to get started.
2013-09-05Rename str::from_bytes to str::from_utf8, closes #8985Florian Hahn-1/+1
2013-06-23Split out starting a listener from accepting incoming connections.Eric Reed-51/+65
The Listener trait takes two type parameters, the type of connection and the type of Acceptor, and specifies only one method, listen, which consumes the listener and produces an Acceptor. The Acceptor trait takes one type parameter, the type of connection, and defines two methods. The accept() method waits for an incoming connection attempt and returns the result. The incoming() method creates an iterator over incoming connections and is a default method. Example: let listener = TcpListener.bind(addr); // Bind to a socket let acceptor = listener.listen(); // Start the listener for stream in acceptor.incoming() { // Process incoming connections forever (or until you break out of the loop) }
2013-08-27Add a variant of home_for_io that consumes the handle. Refactor out common ↵Eric Reed-48/+53
parts of the home_for_io variants.
2013-08-29auto merge of #8819 : vadimcn/rust/unit-tests, r=brsonbors-0/+2
Some of the tests are failing. I've only managed to fix 'memory_map_file', the rest are up for grabs... Fixes #5261.
2013-08-29Revert "auto merge of #8645 : alexcrichton/rust/issue-6436-run-non-blocking, ↵Brian Anderson-244/+50
r=brson" This reverts commit b8d1fa399402c71331aefd634d710004e00b73a6, reversing changes made to f22b4b169854c8a4ba86c16ee43327d6bcf94562. Conflicts: mk/rt.mk src/libuv
2013-08-28Turned off libstd unit tests that currently fail on Windows.Vadim Chugunov-0/+2
2013-08-27Fix merge falloutAlex Crichton-3/+3
2013-08-27Implement process bindings to libuvAlex Crichton-50/+244
Closes #6436
2013-08-27librustc: Fix merge falloutPatrick Walton-14/+14
2013-08-27librustc: Fix problem with cross-crate reexported static methods.Patrick Walton-5/+13
2013-08-27libstd: Fix merge fallout.Patrick Walton-4/+4
2013-08-27librustc: Ensure that type parameters are in the right positions in paths.Patrick Walton-32/+32
This removes the stacking of type parameters that occurs when invoking trait methods, and fixes all places in the standard library that were relying on it. It is somewhat awkward in places; I think we'll probably want something like the `Foo::<for T>::new()` syntax.
2013-08-20Added home_for_io_with_sched variant. Temporarily making IO unkillable.Eric Reed-124/+165
2013-08-22fix 32bit mac build errorJeff Olson-2/+2
2013-08-22std: put FileMode/Access->whence-mask in uvio, open/unlink as fns in file::Jeff Olson-10/+32
2013-08-22std: slight refactor on UvFilestream seek behavior, pre-seek-refactorJeff Olson-29/+30
2013-08-22std: all of the calls in rt::uv::file take a &LoopJeff Olson-7/+6
2013-08-22std: moved static file actions (open,unlink) to FsRequestJeff Olson-2/+2
2013-08-22std: rename tmp file paths to go into ./tmp folder in builddirJeff Olson-1/+1
2013-08-22std: naive stdio print test in uvioJeff Olson-0/+20
2013-08-22std: UvFileStream implements HomingIO + .home_for_io() wrapper usageJeff Olson-39/+60
2013-08-22std: rework file io.. support [p]read,[p]write, impl seek/tell + more testsJeff Olson-32/+79
2013-08-22std: rt::io::file::FileStream fleshed out.. needs more work.. see extendedJeff Olson-6/+7
- change all uses of Path in fn args to &P - FileStream.read assumptions were wrong (libuv file io is non-positional) - the above will mean that we "own" Seek impl info .. should probably push it in UvFileDescriptor.. - needs more tests
2013-08-22std: CRUD file io bindings in uvio, fs_open()/unlink() in IoFactory + testJeff Olson-0/+167
2013-08-20auto merge of #8656 : toddaaro/rust/idle-opt+cleaning, r=brsonbors-1/+1
Fixed a memory leak caused by the singleton idle callback failing to close correctly. The problem was that the close function requires running inside a callback in the event loop, but we were trying to close the idle watcher after the loop returned from run. The fix was to just call run again to process this callback. There is an additional tweak to move the initialization logic fully into bootstrap, so tasks that do not ever call run do not have problems destructing.
2013-08-20auto merge of #8631 : anasazi/rust/homing-io, r=brsonbors-329/+665
libuv handles are tied to the event loop that created them. In order to perform IO, the handle must be on the thread with its home event loop. Thus, when as task wants to do IO it must first go to the IO handle's home event loop and pin itself to the corresponding scheduler while the IO action is in flight. Once the IO action completes, the task is unpinned and either returns to its home scheduler if it is a pinned task, or otherwise stays on the current scheduler. Making new blocking IO implementations (i.e. files) thread safe is rather simple. Add a home field to the IO handle's struct in uvio and implement the HomingIO trait. Wrap every IO call in the HomingIO.home_for_io method, which will take care of the scheduling. I'm not sure if this remains thread safe in the presence of asynchronous IO at the libuv level. If we decide to do that, then this set up should be revisited.
2013-08-20Fixed a memory leak caused by the singleton idle callback failing to close ↵toddaaro-1/+1
correctly. The problem was that the close function requires running inside a callback in the event loop, but we were trying to close the idle watcher after the loop returned from run. The fix was to just call run again to process this callback. There is an additional tweak to move the initialization logic fully into bootstrap, so tasks that do not ever call run do not have problems destructing.
2013-08-20auto merge of #8566 : toddaaro/rust/idle-opt+cleaning, r=catamorphism,brsonbors-7/+82
Instead of a furious storm of idle callbacks we just have one. This is a major performance gain - around 40% on my machine for the ping pong bench. Also in this PR is a cleanup commit for the scheduler code. Was previously up as a separate PR, but bors load + imminent merge hell led me to roll them together. Was #8549.
2013-08-19Make IO thread-safe.Eric Reed-650/+647
Each IO handle has a home event loop, which created it. When a task wants to use an IO handle, it must first make sure it is on that home event loop. It uses the scheduler handle in the IO handle to send itself there before starting the IO action. Once the IO action completes, the task restores its previous home state. If it is an AnySched task, then it will be executed on the new scheduler. If it has a normal home, then it will return there before executing any more code after the IO action.
2013-08-19Homed UDP socketsEric Reed-23/+212
2013-08-19Working homing UDP socket prototype.Eric Reed-1/+151
2013-08-19clean whitespace :/toddaaro-3/+3
2013-08-19Add externfn macro and correctly label fixed_stack_segmentsNiko Matsakis-0/+13
2013-08-16Moved the logic for a pausible idle callback into a new type - ↵toddaaro-18/+72
PausibleIdleCallback and placed the appropriate signatures in rtio and implementation into uvio.
2013-08-16std::rt: Fix a race in UvRemoteCallback's dtor that misses callbacksBrian Anderson-7/+28
Full description in comments.
2013-08-15Add ToCStr method .with_c_str()Kevin Ballard-2/+2
.with_c_str() is a replacement for the old .as_c_str(), to avoid unnecessary boilerplate. Replace all usages of .to_c_str().with_ref() with .with_c_str().
2013-08-06Merge remote-tracking branch 'remotes/origin/master' into ↵Erick Tryzelaar-1/+1
remove-str-trailing-nulls
2013-08-05Updated std::Option, std::Either and std::ResultMarvin Löbel-1/+1
- Made naming schemes consistent between Option, Result and Either - Changed Options Add implementation to work like the maybe monad (return None if any of the inputs is None) - Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead
2013-08-04Merge remote-tracking branch 'remotes/origin/master' into str-remove-nullErick Tryzelaar-40/+22
2013-08-04std: replace str::as_c_str with std::c_strErick Tryzelaar-13/+13
2013-08-04auto merge of #8243 : stepancheg/rust/ipv, r=brsonbors-35/+17
multicast functions now take IpAddr (without port), because they dont't need port. Uv* types renamed: * UvIpAddr -> UvSocketAddr * UvIpv4 -> UvIpv4SocketAddr * UvIpv6 -> UvIpv6SocketAddr "Socket address" is a common name for (ip-address, port) pair (e.g. in sockaddr_in struct). P. S. Are there any backward compatibility concerns? What is std::rt module, is it a part of public API?
2013-08-03remove obsolete `foreach` keywordDaniel Micay-5/+5
this has been replaced by `for`
2013-08-03Rename IpAddr -> SocketAddr, extract IpAddr from SocketAddrStepan Koltsov-35/+17
multicast functions now take IpAddr (without port), because they dont't need port. Uv* types renamed: * UvIpAddr -> UvSocketAddr * UvIpv4 -> UvIpv4SocketAddr * UvIpv6 -> UvIpv6SocketAddr "Socket address" is a common name for (ip-address, port) pair (e.g. in sockaddr_in struct).
2013-08-02replace `range` with an external iteratorDaniel Micay-6/+6
2013-08-01fixed incorrect handling of returned scheduler option and restructed ↵toddaaro-1/+1
scheduler functions slightly
2013-08-01minor tweaks - unboxed the coroutine so that it is no longer a ~ pointer ↵toddaaro-3/+1
inside the task struct, and also added an assert to verify that send is never called inside scheduler context as it is undefined (BROKEN) if that happens
2013-08-01A major refactoring that changes the way the runtime uses TLS. In thetoddaaro-24/+16
old design the TLS held the scheduler struct, and the scheduler struct held the active task. This posed all sorts of weird problems due to how we wanted to use the contents of TLS. The cleaner approach is to leave the active task in TLS and have the task hold the scheduler. To make this work out the scheduler has to run inside a regular task, and then once that is the case the context switching code is massively simplified, as instead of three possible paths there is only one. The logical flow is also easier to follow, as the scheduler struct acts somewhat like a "token" indicating what is active. These changes also necessitated changing a large number of runtime tests, and rewriting most of the runtime testing helpers. Polish level is "low", as I will very soon start on more scheduler changes that will require wiping the polish off. That being said there should be sufficient comments around anything complex to make this entirely respectable as a standalone commit.
2013-07-30std::rt: Change Thread interface to require an explicit joinBrian Anderson-1/+2
Makes it more obvious what's going on