Skip to content

Commit

Permalink
add api mread_close_client
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwu committed Jul 31, 2012
1 parent 16e1d1c commit 9f31245
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mread.c
Expand Up @@ -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;
Expand All @@ -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 *
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions mread.h
Expand Up @@ -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);

Expand Down

0 comments on commit 9f31245

Please sign in to comment.