Skip to content

Commit

Permalink
Merge pull request #90 from zslayton/revert-87-master
Browse files Browse the repository at this point in the history
Revert "upgraded to mio v0.4"
  • Loading branch information
zslayton committed Jul 29, 2015
2 parents 716c67a + e67d42b commit 79bcc9e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ name = "stomp"
"lifeguard" = "*"
"unicode-segmentation" = "*"
"log" = "*"
"mio" = "~0.4.0"
"mio" = "*"
5 changes: 2 additions & 3 deletions src/connection.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//use std::old_io::net::tcp::TcpStream;
use mio::tcp::{TcpStream};
use std::net::TcpStream;
use std::io::BufReader;
use std::io::BufWriter;
use frame::Transmission;
Expand All @@ -24,8 +24,7 @@ pub struct Credentials<'a>(pub &'a str, pub &'a str);
impl Connection {

pub fn new(ip_address: &str, port: u16) -> Result<Connection> {
let addr = (ip_address.to_string() + ":" + &port.to_string()).parse().unwrap();
let tcp_stream = try!(TcpStream::connect(&addr));
let tcp_stream = try!(TcpStream::connect((ip_address, port)));
Ok(Connection {
ip_address: ip_address.to_string(),
port: port,
Expand Down
4 changes: 2 additions & 2 deletions src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use message_builder::MessageBuilder;
use subscription_builder::SubscriptionBuilder;
use frame_buffer::FrameBuffer;

use mio::{EventLoop, Handler, Token, EventSet, Timeout};
use mio::{EventLoop, Handler, Token, ReadHint, Timeout};

pub trait FrameHandler {
fn on_frame(&mut self, &Frame);
Expand Down Expand Up @@ -98,7 +98,7 @@ impl <'a> Handler for Session<'a> {
}
}

fn ready(&mut self, event_loop: &mut EventLoop<Session<'a>>, _token: Token, _: EventSet) {
fn readable(&mut self, event_loop: &mut EventLoop<Session<'a>>, _token: Token, _: ReadHint) {
debug!("Readable! Buffer size: {}", &mut self.read_buffer.len());
debug!("Frame buffer length: {}", &mut self.frame_buffer.len());
let bytes_read = match self.connection.tcp_stream.read(self.read_buffer.deref_mut()){
Expand Down

0 comments on commit 79bcc9e

Please sign in to comment.