work connection
This commit is contained in:
parent
8266ef59e0
commit
464b661bd7
src
target/rls/debug
deps/save-analysis
incremental
minecraft_proxy-1rcub4p4nhz2v
s-gdpbytb248-o8v3mg-3exzum2kks3qc
s-gdpdqg4fcj-1al2xim-working
s-gdpdqg4fcj-1al2xim.locks-gdpdqh5hjs-1ifpv3e-1pzazc0fghmbd
s-gdpdqh5hjs-1ifpv3e.lockminecraft_proxy-2hz3279w2aron
s-gdpbyta87h-1408s8v-ukrj8tfe5b8c
s-gdpdqg2wtk-kfpanp-working
s-gdpdqg2wtk-kfpanp.locks-gdpdqh4g4z-1bzud8d-34n19midchxig
s-gdpdqh4g4z-1bzud8d.lock@ -1,7 +1,7 @@
|
|||||||
use std::net::TcpStream;
|
use std::net::TcpStream;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex, RwLock};
|
||||||
|
|
||||||
mod HandShake;
|
mod HandShake;
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ pub struct Client<'a>{
|
|||||||
//client: &'static TcpStream,
|
//client: &'static TcpStream,
|
||||||
//server: &'static TcpStream,
|
//server: &'static TcpStream,
|
||||||
hs: HandShake::HandShake<'a>,
|
hs: HandShake::HandShake<'a>,
|
||||||
run : Arc<Mutex<bool>>,
|
run : Arc<RwLock<bool>>,
|
||||||
//run: &'static bool
|
//run: &'static bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ impl<'a> Client<'a> {
|
|||||||
//client: client,
|
//client: client,
|
||||||
//server: server,
|
//server: server,
|
||||||
hs: HandShake::HandShake::new(handshake),
|
hs: HandShake::HandShake::new(handshake),
|
||||||
run: Arc::new(Mutex::new(true)),
|
run: Arc::new(RwLock::new(true)),
|
||||||
//run: &true,
|
//run: &true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -34,19 +34,23 @@ impl<'a> Client<'a> {
|
|||||||
|
|
||||||
fn join_conexions_mutex(c1: Arc<Mutex<TcpStream>>,
|
fn join_conexions_mutex(c1: Arc<Mutex<TcpStream>>,
|
||||||
c2: Arc<Mutex<TcpStream>>,
|
c2: Arc<Mutex<TcpStream>>,
|
||||||
run: Arc<Mutex<bool>>,
|
run: Arc<RwLock<bool>>,
|
||||||
id: i32){
|
id: i32){
|
||||||
let mut buf: [u8; 1000000] = [0; 1000000];
|
let mut buf: [u8; 1000000] = [0; 1000000];
|
||||||
while *run.lock().unwrap() {
|
let mut client = c1.lock().unwrap().try_clone().unwrap();
|
||||||
|
while *run.read().unwrap() {
|
||||||
println!("read{}",id);
|
println!("read{}",id);
|
||||||
let res=c1.lock().unwrap().read(&mut buf);
|
let res=client.read(&mut buf);
|
||||||
match res {
|
match res {
|
||||||
Ok(leng) => {
|
Ok(leng) => {
|
||||||
println!("rx {}",leng);
|
println!("rx {}",leng);
|
||||||
|
if leng == 0 {
|
||||||
|
*run.write().unwrap()=false;
|
||||||
|
}
|
||||||
println!("tx {}",c2.lock().unwrap().write(&buf [.. leng]).unwrap());
|
println!("tx {}",c2.lock().unwrap().write(&buf [.. leng]).unwrap());
|
||||||
},
|
},
|
||||||
//Ok(leng) => {c2.lock().unwrap().write(&buf);},
|
//Ok(leng) => {c2.lock().unwrap().write(&buf);},
|
||||||
Err(_e) => {*run.lock().unwrap()=false;},
|
Err(_e) => {*run.write().unwrap()=false;},
|
||||||
}
|
}
|
||||||
println!("write{}",id);
|
println!("write{}",id);
|
||||||
|
|
||||||
|
20
src/main.rs
20
src/main.rs
@ -4,7 +4,7 @@ mod client;
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let listener = TcpListener::bind("127.0.0.1:25567").unwrap();
|
let listener = TcpListener::bind("127.0.0.1:25567").unwrap();
|
||||||
let mut buf: [u8; 128] = [1; 128];
|
let mut buf: [u8; 256] = [1; 256];
|
||||||
for stream in listener.incoming() {
|
for stream in listener.incoming() {
|
||||||
//stream.unwrap().write(buf);
|
//stream.unwrap().write(buf);
|
||||||
match stream {
|
match stream {
|
||||||
@ -15,13 +15,17 @@ fn main() {
|
|||||||
stream.flush();*/
|
stream.flush();*/
|
||||||
println!("Go!");
|
println!("Go!");
|
||||||
let leng = stream.read(&mut buf).unwrap();
|
let leng = stream.read(&mut buf).unwrap();
|
||||||
buf[(buf[0]-1) as usize] += 2;
|
println!("{}", leng);
|
||||||
let mut sstream = TcpStream::connect("127.0.0.1:25565").unwrap();
|
if buf[0] < 200 {
|
||||||
sstream.write(&buf[.. leng]);
|
buf[(buf[0]-1) as usize] += 2;
|
||||||
let c1 = client::Client::new(stream,sstream, &buf);
|
let mut sstream = TcpStream::connect("127.0.0.1:25565").unwrap();
|
||||||
c1.to_string();
|
sstream.write(&buf[.. leng]);
|
||||||
c1.start_proxy().0.join();
|
let c1 = client::Client::new(stream,sstream, &buf);
|
||||||
c1.start_proxy().1.join();
|
c1.to_string();
|
||||||
|
c1.start_proxy();
|
||||||
|
}
|
||||||
|
//c1.start_proxy().0.join();
|
||||||
|
//c1.start_proxy().1.join();
|
||||||
},
|
},
|
||||||
|
|
||||||
Err(_e) => println!("{}",_e),
|
Err(_e) => println!("{}",_e),
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
BIN
target/rls/debug/incremental/minecraft_proxy-1rcub4p4nhz2v/s-gdpdqg4fcj-1al2xim-working/dep-graph.bin
Normal file
BIN
target/rls/debug/incremental/minecraft_proxy-1rcub4p4nhz2v/s-gdpdqg4fcj-1al2xim-working/dep-graph.bin
Normal file
Binary file not shown.
BIN
target/rls/debug/incremental/minecraft_proxy-1rcub4p4nhz2v/s-gdpdqg4fcj-1al2xim-working/dep-graph.part.bin
Normal file
BIN
target/rls/debug/incremental/minecraft_proxy-1rcub4p4nhz2v/s-gdpdqg4fcj-1al2xim-working/dep-graph.part.bin
Normal file
Binary file not shown.
BIN
target/rls/debug/incremental/minecraft_proxy-1rcub4p4nhz2v/s-gdpdqg4fcj-1al2xim-working/query-cache.bin
Normal file
BIN
target/rls/debug/incremental/minecraft_proxy-1rcub4p4nhz2v/s-gdpdqg4fcj-1al2xim-working/query-cache.bin
Normal file
Binary file not shown.
BIN
target/rls/debug/incremental/minecraft_proxy-1rcub4p4nhz2v/s-gdpdqh5hjs-1ifpv3e-1pzazc0fghmbd/dep-graph.bin
Normal file
BIN
target/rls/debug/incremental/minecraft_proxy-1rcub4p4nhz2v/s-gdpdqh5hjs-1ifpv3e-1pzazc0fghmbd/dep-graph.bin
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
target/rls/debug/incremental/minecraft_proxy-2hz3279w2aron/s-gdpdqg2wtk-kfpanp-working/dep-graph.bin
Normal file
BIN
target/rls/debug/incremental/minecraft_proxy-2hz3279w2aron/s-gdpdqg2wtk-kfpanp-working/dep-graph.bin
Normal file
Binary file not shown.
BIN
target/rls/debug/incremental/minecraft_proxy-2hz3279w2aron/s-gdpdqg2wtk-kfpanp-working/dep-graph.part.bin
Normal file
BIN
target/rls/debug/incremental/minecraft_proxy-2hz3279w2aron/s-gdpdqg2wtk-kfpanp-working/dep-graph.part.bin
Normal file
Binary file not shown.
Binary file not shown.
BIN
target/rls/debug/incremental/minecraft_proxy-2hz3279w2aron/s-gdpdqg2wtk-kfpanp-working/work-products.bin
Normal file
BIN
target/rls/debug/incremental/minecraft_proxy-2hz3279w2aron/s-gdpdqg2wtk-kfpanp-working/work-products.bin
Normal file
Binary file not shown.
0
target/rls/debug/incremental/minecraft_proxy-2hz3279w2aron/s-gdpdqg2wtk-kfpanp.lock
Executable file
0
target/rls/debug/incremental/minecraft_proxy-2hz3279w2aron/s-gdpdqg2wtk-kfpanp.lock
Executable file
BIN
target/rls/debug/incremental/minecraft_proxy-2hz3279w2aron/s-gdpdqh4g4z-1bzud8d-34n19midchxig/dep-graph.bin
Normal file
BIN
target/rls/debug/incremental/minecraft_proxy-2hz3279w2aron/s-gdpdqh4g4z-1bzud8d-34n19midchxig/dep-graph.bin
Normal file
Binary file not shown.
BIN
target/rls/debug/incremental/minecraft_proxy-2hz3279w2aron/s-gdpdqh4g4z-1bzud8d-34n19midchxig/query-cache.bin
Normal file
BIN
target/rls/debug/incremental/minecraft_proxy-2hz3279w2aron/s-gdpdqh4g4z-1bzud8d-34n19midchxig/query-cache.bin
Normal file
Binary file not shown.
BIN
target/rls/debug/incremental/minecraft_proxy-2hz3279w2aron/s-gdpdqh4g4z-1bzud8d-34n19midchxig/work-products.bin
Normal file
BIN
target/rls/debug/incremental/minecraft_proxy-2hz3279w2aron/s-gdpdqh4g4z-1bzud8d-34n19midchxig/work-products.bin
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user