Compare commits
2 commits
cd15222685
...
5d134f716d
Author | SHA1 | Date | |
---|---|---|---|
5d134f716d | |||
10c85a9584 |
1 changed files with 2 additions and 2 deletions
|
@ -40,13 +40,13 @@ impl<S: Read + Write> IrcRead for IrcStream<S> {
|
||||||
let mut message: Option<Message> = None;
|
let mut message: Option<Message> = None;
|
||||||
while message == None {
|
while message == None {
|
||||||
let mut temp_buf = [0; 512];
|
let mut temp_buf = [0; 512];
|
||||||
self.stream.read(&mut temp_buf);
|
self.stream.read(&mut temp_buf)?;
|
||||||
self.buffer.push_str(std::str::from_utf8(&temp_buf)?);
|
self.buffer.push_str(std::str::from_utf8(&temp_buf)?);
|
||||||
match self.buffer.find("\r\n") {
|
match self.buffer.find("\r\n") {
|
||||||
Some(i) => {
|
Some(i) => {
|
||||||
let mut raw_message = self.buffer.clone();
|
let mut raw_message = self.buffer.clone();
|
||||||
// This returns the part after the line break to the buffer.
|
// This returns the part after the line break to the buffer.
|
||||||
self.buffer = raw_message.split_off(i);
|
self.buffer = raw_message.split_off(i+2);
|
||||||
message = Some(Message::from(raw_message.as_str()));
|
message = Some(Message::from(raw_message.as_str()));
|
||||||
},
|
},
|
||||||
None => (),
|
None => (),
|
||||||
|
|
Loading…
Reference in a new issue