🐛
This commit is contained in:
@ -260,9 +260,7 @@ class CascadePeerServe(socketserver.StreamRequestHandler):
|
||||
resp.extend(struct.pack('!Q', block.length))
|
||||
resp.extend(data)
|
||||
|
||||
print("sending")
|
||||
self.request.sendall(resp)
|
||||
print("sent")
|
||||
|
||||
def reporterror(self, code: int, msg: str) -> None:
|
||||
msgdata = bytes(msg, 'utf-8')
|
||||
|
BIN
A3/src/cascade
BIN
A3/src/cascade
Binary file not shown.
@ -367,7 +367,6 @@ void get_block(csc_block_t* block, csc_peer_t peer, unsigned char* hash, char* o
|
||||
} else {
|
||||
buffer_size = MAX_LINE;
|
||||
}
|
||||
printf("%i\n", buffer_size);
|
||||
rio_t rio;
|
||||
char rio_buf[buffer_size];
|
||||
int peer_socket;
|
||||
@ -380,7 +379,7 @@ void get_block(csc_block_t* block, csc_peer_t peer, unsigned char* hash, char* o
|
||||
request.reserved[i] = 0;
|
||||
}
|
||||
request.block_num = be64toh(block->index);
|
||||
strncpy(request.hash, hash, 32);
|
||||
memcpy(request.hash, hash, 32);
|
||||
|
||||
memcpy(rio_buf, &request, PEER_REQUEST_HEADER_SIZE);
|
||||
Rio_writen(peer_socket, rio_buf, PEER_REQUEST_HEADER_SIZE);
|
||||
@ -453,6 +452,7 @@ void get_block(csc_block_t* block, csc_peer_t peer, unsigned char* hash, char* o
|
||||
*/
|
||||
int get_peers_list(csc_peer_t** peers, uint8_t hash[32])
|
||||
{
|
||||
|
||||
rio_t rio;
|
||||
uint8_t rio_buf[MAX_LINE];
|
||||
|
||||
@ -469,7 +469,8 @@ int get_peers_list(csc_peer_t** peers, uint8_t hash[32])
|
||||
memcpy(rio_buf, &request_header, HEADER_SIZE);
|
||||
|
||||
struct RequestBody request_body;
|
||||
strncpy(request_body.hash, hash, 32);
|
||||
memcpy(request_body.hash, hash, 32);
|
||||
|
||||
inet_aton(my_ip, &request_body.ip);
|
||||
request_body.port = be16toh(atol(my_port));
|
||||
memcpy(&rio_buf[HEADER_SIZE], &request_body, BODY_SIZE);
|
||||
|
124456
A3/src/tests/shakespeare.100kib.txt
Normal file
124456
A3/src/tests/shakespeare.100kib.txt
Normal file
File diff suppressed because it is too large
Load Diff
124456
A3/src/tests/shakespeare.10kib.txt
Normal file
124456
A3/src/tests/shakespeare.10kib.txt
Normal file
File diff suppressed because it is too large
Load Diff
0
A3/src/tests/shakespeare.10mib.txt
Normal file
0
A3/src/tests/shakespeare.10mib.txt
Normal file
124456
A3/src/tests/shakespeare.1mib.txt
Normal file
124456
A3/src/tests/shakespeare.1mib.txt
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user