mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Remove the receiver field from WebSocket.
The receiver will be used from another thread than the WebSocket object in the future.
This commit is contained in:
parent
56c660d4de
commit
78df6e8d3e
1 changed files with 1 additions and 5 deletions
|
@ -46,7 +46,6 @@ enum WebSocketRequestState {
|
||||||
}
|
}
|
||||||
|
|
||||||
no_jsmanaged_fields!(Sender<WebSocketStream>);
|
no_jsmanaged_fields!(Sender<WebSocketStream>);
|
||||||
no_jsmanaged_fields!(Receiver<WebSocketStream>);
|
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct WebSocket {
|
pub struct WebSocket {
|
||||||
|
@ -55,7 +54,6 @@ pub struct WebSocket {
|
||||||
global: GlobalField,
|
global: GlobalField,
|
||||||
ready_state: Cell<WebSocketRequestState>,
|
ready_state: Cell<WebSocketRequestState>,
|
||||||
sender: RefCell<Option<Sender<WebSocketStream>>>,
|
sender: RefCell<Option<Sender<WebSocketStream>>>,
|
||||||
receiver: RefCell<Option<Receiver<WebSocketStream>>>,
|
|
||||||
failed: Cell<bool>, //Flag to tell if websocket was closed due to failure
|
failed: Cell<bool>, //Flag to tell if websocket was closed due to failure
|
||||||
full: Cell<bool>, //Flag to tell if websocket queue is full
|
full: Cell<bool>, //Flag to tell if websocket queue is full
|
||||||
clean_close: Cell<bool>, //Flag to tell if the websocket closed cleanly (not due to full or fail)
|
clean_close: Cell<bool>, //Flag to tell if the websocket closed cleanly (not due to full or fail)
|
||||||
|
@ -86,7 +84,6 @@ impl WebSocket {
|
||||||
ready_state: Cell::new(WebSocketRequestState::Connecting),
|
ready_state: Cell::new(WebSocketRequestState::Connecting),
|
||||||
failed: Cell::new(false),
|
failed: Cell::new(false),
|
||||||
sender: RefCell::new(None),
|
sender: RefCell::new(None),
|
||||||
receiver: RefCell::new(None),
|
|
||||||
full: Cell::new(false),
|
full: Cell::new(false),
|
||||||
clean_close: Cell::new(true),
|
clean_close: Cell::new(true),
|
||||||
code: Cell::new(0),
|
code: Cell::new(0),
|
||||||
|
@ -136,7 +133,7 @@ impl WebSocket {
|
||||||
WebSocketBinding::Wrap);
|
WebSocketBinding::Wrap);
|
||||||
|
|
||||||
let channel = establish_a_websocket_connection(url, global.get_url().serialize());
|
let channel = establish_a_websocket_connection(url, global.get_url().serialize());
|
||||||
let (temp_sender, temp_receiver) = match channel {
|
let (temp_sender, _temp_receiver) = match channel {
|
||||||
Ok(channel) => channel,
|
Ok(channel) => channel,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
debug!("Failed to establish a WebSocket connection: {:?}", e);
|
debug!("Failed to establish a WebSocket connection: {:?}", e);
|
||||||
|
@ -151,7 +148,6 @@ impl WebSocket {
|
||||||
};
|
};
|
||||||
|
|
||||||
*ws.r().sender.borrow_mut() = Some(temp_sender);
|
*ws.r().sender.borrow_mut() = Some(temp_sender);
|
||||||
*ws.r().receiver.borrow_mut() = Some(temp_receiver);
|
|
||||||
|
|
||||||
//Create everything necessary for starting the open asynchronous task, then begin the task.
|
//Create everything necessary for starting the open asynchronous task, then begin the task.
|
||||||
let global_root = ws.r().global.root();
|
let global_root = ws.r().global.root();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue