Fix of a few compiler warnings

This commit is contained in:
John Jones 2017-07-17 13:05:56 -05:00
parent 656b0b50b7
commit 069379acf4
6 changed files with 28 additions and 4 deletions

View file

@ -5,3 +5,14 @@ getting started: https://github.com/ipfs/specs/blob/master/overviews/implement-i
specifications: https://github.com/ipfs/specs <br>
getting started: https://github.com/ipfs/community/issues/177 <br>
libp2p: https://github.com/libp2p/specs <br>
<br>
Prerequisites: To compile the C version you will need:<br>
lmdb https://github.com/jmjatlanta/lmdb<br>
c-protobuf https://github.com/kenCode/c-protobuf<br>
c-multihash https://github.com/kenCode/c-multihash<br>
c-multiaddr https://github.com/kenCode/c-multiaddr<br>
c-libp2p https://github.com/kenCode/c-libp2p<br>
<br>
And of course this project at https://github.com/kenCode/c-ipfs<br>
<br>
The compilation at this point is simple, but not very flexible. Place all of these projects in a directory. Compile all (the order above is recommended) by going into each one and running "make all".

View file

@ -6,6 +6,7 @@
#include "libp2p/net/p2pnet.h"
#include "libp2p/peer/peerstore.h"
#include "ipfs/core/daemon.h"
#include "ipfs/core/null.h" // for ipfs_null_shutdown
#include "ipfs/core/ipfs_node.h"
#include "ipfs/core/bootstrap.h"
#include "ipfs/repo/fsrepo/fs_repo.h"
@ -18,6 +19,9 @@ int ipfs_daemon_start(char* repo_path) {
struct IpfsNodeListenParams listen_param;
struct MultiAddress* ma = NULL;
// Debugging JMJ
libp2p_logger_add_class("null");
libp2p_logger_info("daemon", "Initializing daemon...\n");
struct IpfsNode* local_node = NULL;

View file

@ -61,7 +61,7 @@ void ipfs_null_connection (void *ptr)
libp2p_logger_log("null", LOGLEVEL_INFO, "Connection %d, count %d\n", connection_param->file_descriptor, *(connection_param->count));
if (libp2p_net_multistream_negotiate(session)) {
if (libp2p_net_multistream_negotiate(&session)) {
for(;;) {
// check if they're looking for an upgrade (i.e. secio)
@ -86,6 +86,7 @@ void ipfs_null_connection (void *ptr)
free(results);
break;
}
libp2p_logger_debug("null", "Secure IO connection successful.\n");
} else if (protocol_compare(results, bytes_read, "/nodeio")) {
libp2p_logger_debug("null", "Attempting a nodeio connection.\n");
if (!libp2p_nodeio_handshake(&session)) {
@ -153,7 +154,7 @@ void ipfs_null_connection (void *ptr)
return;
}
void *ipfs_null_listen (void *ptr)
void* ipfs_null_listen (void *ptr)
{
int socketfd, s, count = 0;
threadpool thpool = thpool_init(25);
@ -170,6 +171,7 @@ void *ipfs_null_listen (void *ptr)
libp2p_logger_error("null", "Ipfs listening on %d\n", listen_param->port);
for (;;) {
libp2p_logger_debug("null", "Attempting socket read\n");
int numDescriptors = socket_read_select4(socketfd, 2);
if (null_shutting_down) {
break;

View file

@ -96,10 +96,13 @@ int ipfs_ping (int argc, char **argv)
}
gettimeofday(&time2, NULL);
// calculate microseconds
time_us = (time2.tv_sec - time1.tv_sec) * 1000000;
time_us += (time2.tv_usec - time1.tv_usec);
fprintf (stderr, "Pong received: time=%d.%03d ms\n", time_us / 1000, time_us % 1000);
usleep(1000000 - time_us);
if (time_us < 1000000) { // if the ping took less than a second...
sleep(1);
}
}
retVal = 1;

View file

@ -73,7 +73,7 @@ struct IpfsRouting {
* @returns true(1) on success, otherwise false(0)
*/
int (*Bootstrap) (struct IpfsRouting*);
void (*Listen) (void*);
void* (*Listen) (void*);
int (*Shutdown) ();
};
typedef struct IpfsRouting ipfs_routing;

View file

@ -1,5 +1,9 @@
#include "ipfs/merkledag/node.h"
/***
* Testing of storage nodes. Nodes can be directories, files, or sections of a file.
*/
int test_node() {
//Variables of link:
char * name = "Alex";