Minor mod to Libp2pLinkedList
This commit is contained in:
parent
72dfe2d786
commit
dc1b8b6b3d
2 changed files with 7 additions and 5 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
struct Libp2pLinkedList {
|
struct Libp2pLinkedList {
|
||||||
void* item;
|
void* item;
|
||||||
void* next;
|
struct Libp2pLinkedList* next;
|
||||||
};
|
};
|
||||||
|
|
||||||
/***
|
/***
|
||||||
|
|
|
@ -28,18 +28,20 @@ int test_multistream_get_list() {
|
||||||
size_t response_size;
|
size_t response_size;
|
||||||
char* filtered = NULL;
|
char* filtered = NULL;
|
||||||
|
|
||||||
struct Stream* stream = libp2p_net_multistream_connect("www.jmjatlanta.com", 4001);
|
struct SecureSession session;
|
||||||
if (*((int*)stream->socket_descriptor) < 0)
|
session.insecure_stream = libp2p_net_multistream_connect("104.131.131.82", 4001);
|
||||||
|
|
||||||
|
if (*((int*)session.insecure_stream->socket_descriptor) < 0)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
// try to respond something, ls command
|
// try to respond something, ls command
|
||||||
const unsigned char* out = "ls\n";
|
const unsigned char* out = "ls\n";
|
||||||
|
|
||||||
if (libp2p_net_multistream_write(stream, out, strlen((char*)out)) <= 0)
|
if (libp2p_net_multistream_write(&session, out, strlen((char*)out)) <= 0)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
// retrieve response
|
// retrieve response
|
||||||
retVal = libp2p_net_multistream_read(stream, &response, &response_size);
|
retVal = libp2p_net_multistream_read(&session, &response, &response_size);
|
||||||
if (retVal <= 0)
|
if (retVal <= 0)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue