🐛
This commit is contained in:
1 parent
57c3e9f626
commit
84fbccb94d
7 files changed
+373372
-5
No files matched your search
@@ -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')
|
||||
|
||||
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 {
|
||||
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);
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Whitespace-only changes.
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user