Introduce set/get function for output event instead of chuncked output ones
This commit is contained in:
parent
461f5f52f2
commit
ee90cbc37c
|
@ -56,4 +56,8 @@ aisl_client_disconnect(aisl_client_t client);
|
|||
aisl_http_version_t
|
||||
aisl_client_get_http_version(aisl_client_t client);
|
||||
|
||||
|
||||
void
|
||||
aisl_client_get_address( aisl_client_t client, struct sockaddr_in * address);
|
||||
|
||||
#endif /* !AISL_CLIENT_H */
|
||||
|
|
|
@ -99,4 +99,12 @@ aisl_write( aisl_stream_t stream, const char * data, int d_len );
|
|||
int
|
||||
aisl_puts( const char * str_data, aisl_stream_t stream );
|
||||
|
||||
|
||||
void
|
||||
aisl_set_output_event(aisl_stream_t stream, bool value);
|
||||
|
||||
|
||||
bool
|
||||
aisl_get_output_event(aisl_stream_t stream);
|
||||
|
||||
#endif /* !AISL_STREAM_H */
|
||||
|
|
16
src/client.c
16
src/client.c
|
@ -225,7 +225,7 @@ aisl_client_output(aisl_client_t client)
|
|||
aisl_stream_t s = client->stream;
|
||||
|
||||
/* while stream is not flushed, we should raise event */
|
||||
if( aisl_stream_get_chunked_output(s) )
|
||||
if( aisl_get_output_event(s) )
|
||||
{
|
||||
/* in case of chunked output ( subscription for AISL_STREAM_OUTPUT event )
|
||||
* stream buffer will be initialized with OUTPUT_BUFFER_SIZE size, but
|
||||
|
@ -487,6 +487,7 @@ aisl_client_set_keepalive(aisl_client_t client, bool value)
|
|||
|
||||
/* API Level ---------------------------------------------------------------- */
|
||||
|
||||
__attribute__ ((visibility ("default") ))
|
||||
aisl_server_t
|
||||
aisl_client_get_server(aisl_client_t client)
|
||||
{
|
||||
|
@ -494,6 +495,7 @@ aisl_client_get_server(aisl_client_t client)
|
|||
}
|
||||
|
||||
|
||||
__attribute__ ((visibility ("default") ))
|
||||
bool
|
||||
aisl_client_is_secure(aisl_client_t client)
|
||||
{
|
||||
|
@ -505,6 +507,7 @@ aisl_client_is_secure(aisl_client_t client)
|
|||
}
|
||||
|
||||
|
||||
__attribute__ ((visibility ("default") ))
|
||||
bool
|
||||
aisl_client_is_online(aisl_client_t client)
|
||||
{
|
||||
|
@ -512,14 +515,25 @@ aisl_client_is_online(aisl_client_t client)
|
|||
}
|
||||
|
||||
|
||||
__attribute__ ((visibility ("default") ))
|
||||
void
|
||||
aisl_client_disconnect(aisl_client_t client)
|
||||
{
|
||||
aisl_client_close(client, AISL_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
__attribute__ ((visibility ("default") ))
|
||||
aisl_http_version_t
|
||||
aisl_client_get_http_version(aisl_client_t client)
|
||||
{
|
||||
return client->http_version;
|
||||
}
|
||||
|
||||
|
||||
__attribute__ ((visibility ("default") ))
|
||||
void
|
||||
aisl_client_get_address( aisl_client_t client, struct sockaddr_in * address)
|
||||
{
|
||||
memcpy(address, &client->address, sizeof(struct sockaddr_in));
|
||||
}
|
||||
|
|
39
src/stream.c
39
src/stream.c
|
@ -68,23 +68,6 @@ aisl_stream_free(aisl_stream_t stream)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
aisl_stream_set_chunked_output(aisl_stream_t stream, bool value)
|
||||
{
|
||||
if (value)
|
||||
stream->flags |= FLAG_OUTPUT_CHUNKED;
|
||||
else if (stream->flags & FLAG_OUTPUT_CHUNKED)
|
||||
stream->flags &= ~FLAG_OUTPUT_CHUNKED;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
aisl_stream_get_chunked_output(aisl_stream_t stream)
|
||||
{
|
||||
return (stream->flags & FLAG_OUTPUT_CHUNKED);
|
||||
}
|
||||
|
||||
|
||||
int32_t
|
||||
aisl_stream_get_buffer_space(aisl_stream_t stream)
|
||||
{
|
||||
|
@ -670,3 +653,25 @@ aisl_stream_get_instance(aisl_stream_t stream)
|
|||
{
|
||||
return stream->client->server->instance;
|
||||
}
|
||||
|
||||
|
||||
__attribute__ ((visibility ("default") ))
|
||||
void
|
||||
aisl_set_output_event(aisl_stream_t stream, bool value)
|
||||
{
|
||||
if (value)
|
||||
stream->flags |= FLAG_OUTPUT_CHUNKED;
|
||||
else if (stream->flags & FLAG_OUTPUT_CHUNKED)
|
||||
stream->flags &= ~FLAG_OUTPUT_CHUNKED;
|
||||
}
|
||||
|
||||
|
||||
__attribute__ ((visibility ("default") ))
|
||||
bool
|
||||
aisl_get_output_event(aisl_stream_t stream)
|
||||
{
|
||||
return (stream->flags & FLAG_OUTPUT_CHUNKED);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -50,14 +50,6 @@ void
|
|||
aisl_stream_free(aisl_stream_t stream);
|
||||
|
||||
|
||||
void
|
||||
aisl_stream_set_chunked_output(aisl_stream_t stream, bool value);
|
||||
|
||||
|
||||
bool
|
||||
aisl_stream_get_chunked_output(aisl_stream_t stream);
|
||||
|
||||
|
||||
int32_t
|
||||
aisl_stream_get_buffer_space(aisl_stream_t stream);
|
||||
|
||||
|
|
Loading…
Reference in New Issue