1
This commit is contained in:
parent
d5303beb75
commit
f6465da990
@ -59,6 +59,9 @@ impl f9::app::UserApp for UserApp {
|
||||
|
||||
impl UserApp {
|
||||
|
||||
pub fn test(&mut self) {
|
||||
}
|
||||
|
||||
pub fn new() -> Self {
|
||||
let p = UserApp{
|
||||
_self_wp: Default::default(),
|
||||
|
@ -90,6 +90,7 @@ impl MyWs {
|
||||
println!("recv buf_len:{0}", tmp_bytes.len());
|
||||
}
|
||||
{
|
||||
UserApp::instance().borrow_mut().test();
|
||||
Arc::downgrade(&mut self.send_queue).upgrade().unwrap().lock().unwrap().borrow_mut().insert(0, tmp_bytes);
|
||||
//Arc::downgrade(&mut self.send_queue).upgrade().unwrap().lock().unwrap().borrow_mut().push(tmp_bytes);
|
||||
}
|
||||
@ -302,7 +303,7 @@ async fn index(req: HttpRequest, stream: web::Payload, data: web::Data<AppStateW
|
||||
resp
|
||||
}
|
||||
|
||||
fn main() {
|
||||
fn main1() {
|
||||
let t1 = thread::spawn(||{
|
||||
//let mut rt = tokio::runtime::Runtime::new().unwrap();
|
||||
let mut rt = tokio::runtime::Builder::new_multi_thread()
|
||||
@ -332,9 +333,32 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
fn main() {
|
||||
App::init(UserApp::instance());
|
||||
{
|
||||
let t1 = thread::spawn(||{
|
||||
//let mut rt = tokio::runtime::Runtime::new().unwrap();
|
||||
let mut rt = tokio::runtime::Builder::new_multi_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap();
|
||||
rt.block_on(async {
|
||||
let counter = web::Data::new(AppStateWithCounter {
|
||||
counter: Mutex::new(0),
|
||||
});
|
||||
HttpServer::new(move || {
|
||||
// move counter into the closure
|
||||
ActixApp::new()
|
||||
.app_data(counter.clone()) // <- register the created data
|
||||
.route("/", web::get().to(index))
|
||||
})
|
||||
.bind(("0.0.0.0", 8080))?
|
||||
.run()
|
||||
.await
|
||||
});
|
||||
println!("hello2");
|
||||
});
|
||||
}
|
||||
App::run();
|
||||
App::uninit();
|
||||
}*/
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user