aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTill Hoeppner2014-11-07 15:56:58 +0100
committerTill Hoeppner2014-11-07 15:56:58 +0100
commitd738bcd85bc9d7ea47d8995a57a594ead6bb0f73 (patch)
tree6a5f797eeff751c84eed37dde44d7d9058386528
parentc134482094fe8f84491e96f919283359ea8d5e4b (diff)
downloadirsc-d738bcd85bc9d7ea47d8995a57a594ead6bb0f73.tar.gz
irsc-d738bcd85bc9d7ea47d8995a57a594ead6bb0f73.tar.xz
irsc-d738bcd85bc9d7ea47d8995a57a594ead6bb0f73.zip
Fixed TcpStream::connect invocation
-rw-r--r--src/lib.rs3
-rw-r--r--src/server.rs8
2 files changed, 8 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs
index a6125d7..6d0b42d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -4,6 +4,9 @@
extern crate regex_macros;
extern crate regex;
+#[phase(plugin, link)]
+extern crate log;
+
pub mod server;
pub mod color;
pub mod ident;
diff --git a/src/server.rs b/src/server.rs
index 99b8fb0..b783a25 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -49,7 +49,7 @@ impl Server {
pub fn connect(&mut self, host: String, port: u16) -> Result<(), Failure> {
let mut s = self.stream.lock();
match *s { Some(_) => return Err(AlreadyConnected), _ => () };
- *s = match TcpStream::connect(host.as_slice(), port) {
+ *s = match TcpStream::connect((host.as_slice(), port)) {
Ok(tcp) => Some(tcp),
Err(e) => return Err(Io(e))
};
@@ -59,7 +59,7 @@ impl Server {
#[inline]
fn sendraw(&mut self, s: &str, newline: bool) -> Result<(), Failure> {
- println!("{}", s);
+ info!("OUT: {}", s);
let mut locked_stream = self.stream.lock();
if locked_stream.is_some() {
locked_stream.as_mut().map(|stream| {
@@ -112,7 +112,9 @@ impl Server {
loop {
let line = reader.read_line().unwrap();
let mut parts = line.as_slice().split(' ').collect::<Vec<&str>>();
- println!("{}", parts);
+
+ info!("IN: {}", line);
+
if parts.len() == 0 {
continue;
}