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