-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
solanav
committed
Jan 29, 2020
1 parent
1fb53bd
commit e96df6c
Showing
16 changed files
with
65 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use std::fmt; | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
pub enum BucketError { | ||
BucketFull, | ||
IncorrectBucket, | ||
RepeatedLNode, | ||
LNodeNotFound, | ||
NodeNotFound, | ||
IndexError, | ||
} | ||
|
||
impl std::error::Error for BucketError {} | ||
|
||
impl fmt::Display for BucketError { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
match *self { | ||
BucketError::BucketFull => write!(f, "This bucket is full."), | ||
BucketError::IncorrectBucket => write!(f, "The node does not fit."), | ||
BucketError::RepeatedLNode => write!(f, "There already is a local node."), | ||
BucketError::LNodeNotFound => write!(f, "Could not find the local node."), | ||
BucketError::NodeNotFound => write!(f, "Could not find the node."), | ||
BucketError::IndexError => write!(f, "Index is out of bounds."), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
pub mod types; // Data structures shared by other modules | ||
pub mod bucket; // Data structures shared by other modules | ||
pub mod server; // Server that listens for packets | ||
pub mod client; // Functions used to send messages to other peers | ||
pub mod bootstrap; // Functions used to get into the network when restarted | ||
pub mod id; // Id of a node in the network | ||
pub mod node; // Structure representing a node in the network | ||
pub mod packet; // Packet structure of the protocol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
use samurai::server::passive::Server; | ||
use std::time::Duration; | ||
use std::thread; | ||
use samurai::client::active::{send_node, ping}; | ||
use samurai::server::threadpool::ThreadPool; | ||
use std::net::{TcpStream, Ipv4Addr, IpAddr, SocketAddr}; | ||
|
||
fn main() { | ||
let server = Server::new(); | ||
let _server = Server::new(); | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use samurai::types::id::Id; | ||
use samurai::id::Id; | ||
|
||
#[test] | ||
fn test_add() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters