Fix ownership issues (still not working yet)
This commit is contained in:
parent
92ee775225
commit
41f34e26fb
12
src/lib.rs
12
src/lib.rs
|
@ -330,12 +330,12 @@ impl Client {
|
|||
let mut buffer = [0u8; 512];
|
||||
|
||||
if self.config.ssl {
|
||||
match self.sslstream.unwrap().read(&mut buffer) {
|
||||
match self.sslstream.as_mut().unwrap().read(&mut buffer) {
|
||||
Ok(_) => {}
|
||||
Err(_) => return None,
|
||||
};
|
||||
} else {
|
||||
match self.stream.as_ref().unwrap().read(&mut buffer) {
|
||||
match self.stream.as_mut().unwrap().read(&mut buffer) {
|
||||
Ok(_) => {}
|
||||
Err(_) => return None,
|
||||
};
|
||||
|
@ -374,11 +374,11 @@ impl Client {
|
|||
};
|
||||
if self.config.ssl {
|
||||
self.sslstream
|
||||
.as_ref()
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.write(formatted.as_bytes())?;
|
||||
} else {
|
||||
self.stream.as_ref().unwrap().write(formatted.as_bytes())?;
|
||||
self.stream.as_mut().unwrap().write(formatted.as_bytes())?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -675,9 +675,9 @@ impl Client {
|
|||
)))?;
|
||||
}
|
||||
if self.config.ssl {
|
||||
self.sslstream.as_ref().unwrap().shutdown().unwrap();
|
||||
self.sslstream.as_mut().unwrap().shutdown().unwrap();
|
||||
} else {
|
||||
self.stream.unwrap().shutdown(std::net::Shutdown::Both)?;
|
||||
self.stream.as_mut().unwrap().shutdown(std::net::Shutdown::Both)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -13,10 +13,11 @@ fn main() -> Result<(), std::io::Error> {
|
|||
//let config = Config::from_toml("config.toml")?;
|
||||
let config = Config::new(
|
||||
vec!["#main", "#no-normies"],
|
||||
"192.168.1.28",
|
||||
"karx.xyz",
|
||||
Some("+B"),
|
||||
Some("circe"),
|
||||
6667,
|
||||
6697,
|
||||
true,
|
||||
"circe",
|
||||
);
|
||||
let mut client = Client::new(config)?;
|
||||
|
|
Loading…
Reference in a new issue