Handle nested socket within stream alloc/free.

This commit is contained in:
Michael Jumper 2012-10-19 14:24:03 -07:00
parent 9d8d0650f5
commit fe30cd3073

View File

@ -101,6 +101,12 @@ guac_stream* guac_client_alloc_stream(guac_client* client) {
guac_stream* allocd_stream = malloc(sizeof(guac_stream));
allocd_stream->index = guac_pool_next_int(client->__stream_pool);
/* Nest socket */
allocd_stream->socket = guac_socket_nest(
client->socket,
allocd_stream->index
);
return allocd_stream;
}
@ -109,6 +115,9 @@ void guac_client_free_stream(guac_client* client, guac_stream* stream) {
/* Release index to pool */
guac_pool_free_int(client->__stream_pool, stream->index - 1);
/* Release socket */
guac_socket_free(stream->socket);
/* Free stream */
free(stream);