summary refs log tree commit diff
path: root/src/libstd/rt/rtio.rs
AgeCommit message (Collapse)AuthorLines
2013-09-18Implement process bindings to libuvAlex Crichton-0/+19
This is a re-landing of #8645, except that the bindings are *not* being used to power std::run just yet. Instead, this adds the bindings as standalone bindings inside the rt::io::process module. I made one major change from before, having to do with how pipes are created/bound. It's much clearer now when you can read/write to a pipe, as there's an explicit difference (different types) between an unbound and a bound pipe. The process configuration now takes unbound pipes (and consumes ownership of them), and will return corresponding pipe structures back if spawning is successful (otherwise everything is destroyed normally).
2013-09-17std: remove RtioStreamJeff Olson-5/+0
2013-09-16std: remove impl'd/commented-out fstat signaturesJeff Olson-1/+0
2013-09-16std: bind uv_fs_readdir(), flesh out DirectoryInfo and docs/cleanupJeff Olson-0/+2
2013-09-16std: adding file::{stat,mkdir,rmdir}, FileInfo and FileReader/FileWriterJeff Olson-0/+2
add ignores for win32 tests on previous file io stuff...
2013-09-16std/rt: in-progress file io workJeff Olson-1/+8
std: remove unneeded field from RequestData struct std: rt::uv::file - map us_fs_stat & start refactoring calls into FsRequest std: stubbing out stat calls from the top-down into uvio std: us_fs_* operations are now by-val self methods on FsRequest std: post-rebase cleanup std: add uv_fs_mkdir|rmdir + tests & minor test cleanup in rt::uv::file WORKING: fleshing out FileStat and FileInfo + tests std: reverting test files.. refactoring back and cleanup...
2013-09-05std::rt: Add get_host_addresses functionBrian Anderson-0/+1
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-06-23Split out starting a listener from accepting incoming connections.Eric Reed-0/+5
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-29Revert "auto merge of #8645 : alexcrichton/rust/issue-6436-run-non-blocking, ↵Brian Anderson-19/+3
r=brson" This reverts commit b8d1fa399402c71331aefd634d710004e00b73a6, reversing changes made to f22b4b169854c8a4ba86c16ee43327d6bcf94562. Conflicts: mk/rt.mk src/libuv
2013-08-27Implement process bindings to libuvAlex Crichton-3/+19
Closes #6436
2013-08-22std: put FileMode/Access->whence-mask in uvio, open/unlink as fns in file::Jeff Olson-1/+2
2013-08-22std: slight refactor on UvFilestream seek behavior, pre-seek-refactorJeff Olson-1/+2
2013-08-22std: rework file io.. support [p]read,[p]write, impl seek/tell + more testsJeff Olson-5/+10
2013-08-22std: rt::io::file::FileStream fleshed out.. needs more work.. see extendedJeff Olson-2/+3
- 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/+23
2013-08-20auto merge of #8631 : anasazi/rust/homing-io, r=brsonbors-1/+1
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-19Make IO thread-safe.Eric Reed-2/+2
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-1/+1
2013-08-16Moved the logic for a pausible idle callback into a new type - ↵toddaaro-5/+8
PausibleIdleCallback and placed the appropriate signatures in rtio and implementation into uvio.
2013-08-03Rename IpAddr -> SocketAddr, extract IpAddr from SocketAddrStepan Koltsov-8/+8
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-07-25libstd: Implement some missing udp methods.Luqman Aden-8/+8
2013-07-25libstd: Implement some missing tcp methods.Luqman Aden-6/+6
2013-07-25libstd: Implement {peer, socket}_name for new rt tcp & udp.Luqman Aden-2/+2
2013-07-22std: add RtioTimer and UvTimer impl atop rt::uvJeff Olson-0/+6
2013-07-19Changed methods on UDP sockets and TCP/UDP watchers to &mut self to reflect ↵Eric Reed-20/+20
that libuv may change the underlying handle.
2013-07-02converted TODOs into XXXsEric Reed-1/+0
2013-07-02IPv6 support for UDP and TCP.Eric Reed-3/+27
2013-06-19socket based UDP ioEric Reed-7/+7
2013-06-17Added a RtioUdpStream traitEric Reed-0/+7
2013-05-29Merge remote-tracking branch 'brson/io' into incomingBrian Anderson-0/+11
Conflicts: src/libstd/rt/sched.rs
2013-05-22libstd: Rename libcore to libstd and libstd to libextra; update makefiles.Patrick Walton-0/+45
This only changes the directory names; it does not change the "real" metadata names.