Skip to content

Commit

Permalink
Disable the debugger on Android until mio works on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
larsbergstrom committed Nov 18, 2016
1 parent 8708410 commit ca0078a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions components/debugger/Cargo.toml
Expand Up @@ -13,4 +13,6 @@ crate_type = ["rlib"]
[dependencies]
log = "0.3.5"
util = {path = "../util"}

[target.'cfg(not(target_os = "android"))'.dependencies]
ws = "0.5.3"
16 changes: 16 additions & 0 deletions components/debugger/lib.rs
Expand Up @@ -5,11 +5,13 @@
#[macro_use]
extern crate log;
extern crate util;
#[cfg(not(target_os = "android"))]
extern crate ws;

use std::sync::mpsc;
use std::sync::mpsc::channel;
use util::thread::spawn_named;
#[cfg(not(target_os = "android"))]
use ws::{Builder, CloseCode, Handler, Handshake};

enum Message {
Expand All @@ -18,10 +20,12 @@ enum Message {

pub struct Sender(mpsc::Sender<Message>);

#[cfg(not(target_os = "android"))]
struct Connection {
sender: ws::Sender
}

#[cfg(not(target_os = "android"))]
impl Handler for Connection {
fn on_open(&mut self, _: Handshake) -> ws::Result<()> {
debug!("Connection opened.");
Expand All @@ -37,6 +41,7 @@ impl Handler for Connection {
}
}

#[cfg(not(target_os = "android"))]
pub fn start_server(port: u16) -> Sender {
debug!("Starting server.");
let (sender, receiver) = channel();
Expand All @@ -60,10 +65,21 @@ pub fn start_server(port: u16) -> Sender {
Sender(sender)
}

#[cfg(target_os = "android")]
pub fn start_server(_: u16) -> Sender {
panic!("Debugger is not supported on Android");
}

#[cfg(not(target_os = "android"))]
pub fn shutdown_server(sender: &Sender) {
debug!("Shutting down server.");
let &Sender(ref sender) = sender;
if let Err(_) = sender.send(Message::ShutdownServer) {
warn!("Failed to shut down server.");
}
}

#[cfg(target_os = "android")]
pub fn shutdown_server(_: &Sender) {
panic!("Debugger is not supported on Android");
}

0 comments on commit ca0078a

Please sign in to comment.