server handshake gui
This commit is contained in:
@@ -33,9 +33,9 @@ pub async fn register_with_the_server(
|
||||
/// sends a get request to the server to get the socket address of the given peer
|
||||
///
|
||||
|
||||
pub async fn get_socket_address(username: String) -> Result<Bytes, reqwest::Error> {
|
||||
pub async fn get_socket_address(username: String, ip: String) -> Result<Bytes, reqwest::Error> {
|
||||
let client = reqwest::Client::new();
|
||||
let uri = format!("https://jch.irif.fr:8443/peers/{}/addresses", username);
|
||||
let uri = format!("{}/peers/{}/addresses", ip, username);
|
||||
let res = client.get(uri).send().await?;
|
||||
if res.status().is_success() {
|
||||
println!("Successfully retreived the addresses.");
|
||||
@@ -70,7 +70,7 @@ pub fn register_ip_addresses(
|
||||
crypto_pair: &CryptographicSignature,
|
||||
server_uri: String,
|
||||
senders: &MultipleSenders,
|
||||
messages_list: &Arc<Mutex<HashMap<i32, EventType>>>,
|
||||
messages_list: &Mutex<HashMap<i32, EventType>>,
|
||||
id: i32,
|
||||
) {
|
||||
let username_size = crypto_pair.username.len();
|
||||
@@ -92,6 +92,7 @@ pub fn register_ip_addresses(
|
||||
list.insert(id, EventType::ServerHelloReply);
|
||||
}
|
||||
}
|
||||
println!("message sent: {}", &id);
|
||||
// 3. Perform the insertion
|
||||
/*let mut buf = [0u8; 1024];
|
||||
socket.recv_from(&mut buf).expect("receive failed");
|
||||
|
||||
Reference in New Issue
Block a user