summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortom barrett <spalf0@gmail.com>2018-04-16 03:05:39 -0500
committertom barrett <spalf0@gmail.com>2018-04-16 03:05:39 -0500
commit7da5495fc815c2cf255b03f100a5b800a5e5f0ff (patch)
tree7815a11941fe4f12f7420e0186a8d6483b8ac10d
parent2940809bf50c2874487ba55efb17ba03c52dd9c2 (diff)
-conformed connection to naming convention
-rw-r--r--src/bin/server.rs4
-rw-r--r--src/lib.rs1
-rw-r--r--src/mass.rs6
-rw-r--r--src/server/connection.rs (renamed from src/connection.rs)8
-rw-r--r--src/server/dashboard.rs4
-rw-r--r--src/server/engines.rs4
-rw-r--r--src/server/mining.rs4
-rw-r--r--src/server/mod.rs1
-rw-r--r--src/server/navigation.rs4
9 files changed, 18 insertions, 18 deletions
diff --git a/src/bin/server.rs b/src/bin/server.rs
index 68e091e..1fad1d3 100644
--- a/src/bin/server.rs
+++ b/src/bin/server.rs
@@ -7,7 +7,7 @@ use std::collections::HashMap;
use space::mass::Mass;
use space::math::rand_name;
-use space::connection::Connection;
+use space::server::connection::ServerConnection;
fn populate() -> HashMap<String, Mass> {
let mut masses : HashMap<String, Mass> = HashMap::new();
@@ -28,7 +28,7 @@ fn main() {
let mut connections = Vec::new();
for stream in listener.incoming() {
match stream {
- Ok(stream) => connections.push(Connection::new(stream, &mut masses)),
+ Ok(stream) => connections.push(ServerConnection::new(stream, &mut masses)),
_ => {
for i in 0..connections.len() {
connections[i].process(&mut masses);
diff --git a/src/lib.rs b/src/lib.rs
index 9b8050c..608a1ee 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -8,4 +8,3 @@ pub mod module;
pub mod client;
pub mod server;
pub mod storage;
-pub mod connection;
diff --git a/src/mass.rs b/src/mass.rs
index 762c9ab..f38ab6d 100644
--- a/src/mass.rs
+++ b/src/mass.rs
@@ -5,7 +5,7 @@ use self::rand::distributions::Range;
use self::rand::distributions::Sample;
use storage::Storage;
-use module::{Module, ModuleType};
+use module::Module;
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Mass {
@@ -61,8 +61,8 @@ impl Mass {
Mass {
mass_type : ship,
- position : (0.0,0.0,0.0),
- velocity : (0.0,0.0,0.0),
+ position : (0.0, 0.0, 0.0),
+ velocity : (0.0, 0.0, 0.0),
}
}
diff --git a/src/connection.rs b/src/server/connection.rs
index f4637e4..8354d70 100644
--- a/src/connection.rs
+++ b/src/server/connection.rs
@@ -8,7 +8,7 @@ use std::collections::HashMap;
use module::{Module, ModuleType};
use mass::{Mass, MassType};
-pub struct Connection {
+pub struct ServerConnection {
pub name : String,
pub module : Module,
pub stream : TcpStream,
@@ -16,8 +16,8 @@ pub struct Connection {
pub open : bool,
}
-impl Connection {
- pub fn new(mut stream : TcpStream, masses : &mut HashMap<String, Mass>) -> Connection {
+impl ServerConnection {
+ pub fn new(mut stream : TcpStream, masses : &mut HashMap<String, Mass>) -> ServerConnection {
let mut buff_r = BufReader::new(stream.try_clone().unwrap());
let mut recv = String::new();
@@ -37,7 +37,7 @@ impl Connection {
let module : Module = serde_json::from_str(&recv.replace("\n","")).unwrap();
stream.set_nonblocking(true).unwrap();
- Connection {
+ ServerConnection {
name : String::from(name),
module : module,
stream : stream,
diff --git a/src/server/dashboard.rs b/src/server/dashboard.rs
index 81ac522..91d8831 100644
--- a/src/server/dashboard.rs
+++ b/src/server/dashboard.rs
@@ -4,9 +4,9 @@ use std::io::Write;
use std::collections::HashMap;
use mass::Mass;
-use connection::Connection;
+use server::connection::ServerConnection;
-impl Connection {
+impl ServerConnection {
pub fn server_dashboard(&mut self, masses : &mut HashMap<String, Mass>) -> bool {
let ship = masses.get(&self.name).unwrap();
let send = serde_json::to_string(&ship).unwrap() + "\n";
diff --git a/src/server/engines.rs b/src/server/engines.rs
index 85346f6..c2a97ef 100644
--- a/src/server/engines.rs
+++ b/src/server/engines.rs
@@ -6,10 +6,10 @@ use std::collections::HashMap;
use mass::{Mass, MassType};
use module::{ModuleType};
-use connection::Connection;
use module::NavigationStatus;
+use server::connection::ServerConnection;
-impl Connection {
+impl ServerConnection {
pub fn server_engines(&mut self, masses : &mut HashMap<String, Mass>) -> bool {
let masses_clone = masses.clone();
diff --git a/src/server/mining.rs b/src/server/mining.rs
index 98803c5..2364f9f 100644
--- a/src/server/mining.rs
+++ b/src/server/mining.rs
@@ -7,7 +7,7 @@ use std::collections::HashMap;
use math::distance;
use mass::{Mass, MassType};
use module::ModuleType;
-use connection::Connection;
+use::server::connection::ServerConnection;
#[derive(Serialize, Deserialize, Debug, Clone)]
struct ServerData {
@@ -17,7 +17,7 @@ struct ServerData {
mining_status : bool,
}
-impl Connection {
+impl ServerConnection {
pub fn server_mining(&mut self, masses : &mut HashMap<String, Mass>) -> bool {
let masses_clone = masses.clone();
let ship = masses.get_mut(&self.name).unwrap();
diff --git a/src/server/mod.rs b/src/server/mod.rs
index baabf96..444e487 100644
--- a/src/server/mod.rs
+++ b/src/server/mod.rs
@@ -2,3 +2,4 @@ pub mod mining;
pub mod engines;
pub mod dashboard;
pub mod navigation;
+pub mod connection;
diff --git a/src/server/navigation.rs b/src/server/navigation.rs
index 58d88e7..1d332f9 100644
--- a/src/server/navigation.rs
+++ b/src/server/navigation.rs
@@ -8,9 +8,9 @@ use std::collections::HashMap;
use math::distance;
use module::{ModuleType, NavigationStatus};
use mass::{Mass, MassType};
-use connection::Connection;
+use server::connection::ServerConnection;
-impl Connection {
+impl ServerConnection {
pub fn server_navigation(&mut self, masses : &mut HashMap<String, Mass>) -> bool {
let masses_clone = masses.clone();
let ship = masses.get_mut(&self.name).unwrap();