Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add api mread_close_client

  • Loading branch information...
commit 9f3124539473ac1e49b3b7375fa73a7d7c9e61c0 1 parent 16e1d1c
@cloudwu authored
Showing with 6 additions and 5 deletions.
  1. +5 −5 mread.c
  2. +1 −0  mread.h
View
10 mread.c
@@ -305,8 +305,8 @@ _link_node(struct ringbuffer * rb, int id, struct socket * s , struct ringbuffer
}
}
-static void
-_close_client(struct mread_pool * self, int id) {
+void
+mread_close_client(struct mread_pool * self, int id) {
struct socket * s = &self->sockets[id];
s->status = SOCKET_CLOSED;
s->node = NULL;
@@ -324,7 +324,7 @@ _close_active(struct mread_pool * self) {
struct socket * s = &self->sockets[id];
ringbuffer_free(self->rb, s->temp);
ringbuffer_free(self->rb, s->node);
- _close_client(self, id);
+ mread_close_client(self, id);
}
static char *
@@ -375,7 +375,7 @@ mread_pull(struct mread_pool * self , int size) {
struct ringbuffer_block * blk = ringbuffer_alloc(rb , rd);
while (blk == NULL) {
int collect_id = ringbuffer_collect(rb);
- _close_client(self , collect_id);
+ mread_close_client(self , collect_id);
if (id == collect_id) {
return NULL;
}
@@ -427,7 +427,7 @@ mread_pull(struct mread_pool * self , int size) {
struct ringbuffer_block * temp = ringbuffer_alloc(rb, size);
while (temp == NULL) {
int collect_id = ringbuffer_collect(rb);
- _close_client(self , collect_id);
+ mread_close_client(self , collect_id);
if (id == collect_id) {
return NULL;
}
View
1  mread.h
@@ -9,6 +9,7 @@ void mread_close(struct mread_pool *m);
int mread_poll(struct mread_pool *m , int timeout);
void * mread_pull(struct mread_pool *m , int size);
void mread_yield(struct mread_pool *m);
+void mread_close_client(struct mread_pool *m, int id);
int mread_closed(struct mread_pool *m);
int mread_socket(struct mread_pool *m , int index);
Please sign in to comment.
Something went wrong with that request. Please try again.