Fixed plugin loader dir not found
This commit is contained in:
+12
-5
@@ -70,17 +70,24 @@ impl PluginLoader {
|
|||||||
let plugin_clients = self.plugin_clients.clone();
|
let plugin_clients = self.plugin_clients.clone();
|
||||||
let listener = TcpListener::bind("0.0.0.0:7243").unwrap();
|
let listener = TcpListener::bind("0.0.0.0:7243").unwrap();
|
||||||
|
|
||||||
std::thread::spawn(move || {
|
let handle_plugin = move |stream: Result<TcpStream, std::io::Error>| -> crate::Result<()> {
|
||||||
for stream in listener.incoming() {
|
let stream = stream?;
|
||||||
let stream = stream.unwrap();
|
|
||||||
let mut reader = BufReader::new(&stream);
|
let mut reader = BufReader::new(&stream);
|
||||||
let mut s = String::new();
|
let mut s = String::new();
|
||||||
reader.read_line(&mut s).unwrap();
|
reader.read_line(&mut s)?;
|
||||||
let plugin_handshake: PluginHandshake = serde_json::from_str(&s).unwrap();
|
let plugin_handshake: PluginHandshake = serde_json::from_str(&s)?;
|
||||||
plugin_clients
|
plugin_clients
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.insert(plugin_handshake.id, stream);
|
.insert(plugin_handshake.id, stream);
|
||||||
|
Ok(())
|
||||||
|
};
|
||||||
|
|
||||||
|
std::thread::spawn(move || {
|
||||||
|
for stream in listener.incoming() {
|
||||||
|
if let Err(e) = handle_plugin(stream) {
|
||||||
|
LOGGER.error(format!("Plugin error: {e}"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user