Started project
This commit is contained in:
@ -156,7 +156,7 @@ void get_data_sha(const char* sourcedata, unsigned char* hash, uint32_t data_siz
|
||||
* E.g. parse a cascade file and get all the relevent data from somewhere else on the
|
||||
* network.
|
||||
*/
|
||||
void download_only_peer(char *cascade_file)
|
||||
void download_only_client(char *cascade_file)
|
||||
{
|
||||
printf("Managing download only for: %s\n", cascade_file);
|
||||
if (access(cascade_file, F_OK ) != 0 )
|
||||
@ -564,6 +564,33 @@ int get_peers_list(csc_peer_t** peers, uint8_t hash[32])
|
||||
return peercount;
|
||||
}
|
||||
|
||||
void service_block_request(char* request) {
|
||||
// decode request
|
||||
// send block, or if something goes wrong, an error code
|
||||
}
|
||||
|
||||
void server(csc_file_t cascade_file) {
|
||||
// accept requests and make new threads to
|
||||
// send blocks
|
||||
}
|
||||
|
||||
void subscribe(csc_file_t cascade_file) {
|
||||
// Send 'subscribe' request to peer
|
||||
}
|
||||
|
||||
void client(csc_file_t cascade_file) {
|
||||
// Mostly just the code from download_only_client
|
||||
}
|
||||
|
||||
void start_peer(char* cascade_file){
|
||||
// parse cascade file (remove from client())
|
||||
// mutex in csc_file_t struct
|
||||
// start client and server on separate threads
|
||||
download_only_client(cascade_file);
|
||||
|
||||
// subscribe to peer
|
||||
}
|
||||
|
||||
/*
|
||||
* The entry point for the code. Parses command line arguments and starts up the appropriate peer code.
|
||||
*/
|
||||
@ -627,7 +654,7 @@ int main(int argc, char **argv)
|
||||
|
||||
for (int j=0; j<casc_count; j++)
|
||||
{
|
||||
download_only_peer(cascade_files[j]);
|
||||
start_peer(cascade_files[j]);
|
||||
}
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
|
Reference in New Issue
Block a user