Using the correct socket descriptor
This commit is contained in:
parent
c1e7131c7c
commit
609ed80aaf
1 changed files with 3 additions and 3 deletions
|
@ -19,7 +19,7 @@
|
||||||
int libp2p_net_multistream_close(void* stream_context) {
|
int libp2p_net_multistream_close(void* stream_context) {
|
||||||
struct SessionContext* secure_context = (struct SessionContext*)stream_context;
|
struct SessionContext* secure_context = (struct SessionContext*)stream_context;
|
||||||
struct Stream* stream = secure_context->insecure_stream;
|
struct Stream* stream = secure_context->insecure_stream;
|
||||||
close((intptr_t)stream->socket_descriptor);
|
close( *((int*)stream->socket_descriptor));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,9 +69,9 @@ int libp2p_net_multistream_read(void* stream_context, unsigned char** results, s
|
||||||
|
|
||||||
// first read the varint
|
// first read the varint
|
||||||
while(1) {
|
while(1) {
|
||||||
unsigned char c;
|
unsigned char c = '\0';
|
||||||
bytes = socket_read(*((int*)stream->socket_descriptor), (char*)&c, 1, 0, timeout_secs);
|
bytes = socket_read(*((int*)stream->socket_descriptor), (char*)&c, 1, 0, timeout_secs);
|
||||||
if (bytes == 0) { // timeout
|
if (bytes <= 0) { // timeout
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
pos[0] = c;
|
pos[0] = c;
|
||||||
|
|
Loading…
Reference in a new issue