Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/emmyoh/oku-fs
Browse files Browse the repository at this point in the history
  • Loading branch information
emmyoh committed May 6, 2024
2 parents 7b30b81 + c65335d commit 09808e4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ impl OkuFs {
if let Some(first_line) = incoming_lines.next() {
println!(
"First: {:#?}",
String::from_utf8_lossy(&first_line).to_string()
String::from_utf8_lossy(first_line).to_string()
);
if first_line == ALPN_DOCUMENT_TICKET_FETCH {
let remaining_lines: Vec<Vec<u8>> =
Expand All @@ -461,7 +461,7 @@ impl OkuFs {
println!("Response: {:#?}", peer_content_response);
let peer_content_response_string =
serde_json::to_string(&peer_content_response)?;
stream.write_all(&peer_content_response_string.as_bytes())?;
stream.write_all(peer_content_response_string.as_bytes())?;
stream.flush()?;
}
}
Expand Down Expand Up @@ -524,8 +524,8 @@ impl OkuFs {
let info_hash = to_infohash(q.content);
println!("content corresponds to infohash {}", info_hash);
let peer_content_request = PeerContentRequest {
namespace_id: namespace_id,
path: path,
namespace_id,
path,
};
let peer_content_request_string = serde_json::to_string(&peer_content_request)?;
println!(
Expand Down Expand Up @@ -569,7 +569,7 @@ impl OkuFs {
let mut request = Vec::new();
request.write_all(ALPN_DOCUMENT_TICKET_FETCH)?;
request.write_all(b"\n")?;
request.write_all(&peer_content_request_string.as_bytes())?;
request.write_all(peer_content_request_string.as_bytes())?;
request.flush()?;
// stream.write_all(ALPN_DOCUMENT_TICKET_FETCH)?;
// stream.write_all(&peer_content_request_bytes)?;
Expand All @@ -578,7 +578,7 @@ impl OkuFs {
let mut response_bytes = Vec::new();
stream.read_to_end(&mut response_bytes)?;
let response: PeerContentResponse =
serde_json::from_str(&String::from_utf8_lossy(&response_bytes).to_string())?;
serde_json::from_str(String::from_utf8_lossy(&response_bytes).as_ref())?;
println!("Response: {:#?}", response);
match response.ticket_response {
PeerTicketResponse::Document(document_ticket) => {
Expand Down

0 comments on commit 09808e4

Please sign in to comment.