Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

add api mread_close_client

  • Loading branch information...
commit 9f3124539473ac1e49b3b7375fa73a7d7c9e61c0 1 parent 16e1d1c
云风 authored

Showing 2 changed files with 6 additions and 5 deletions. Show diff stats Hide diff stats

  1. +5 5 mread.c
  2. +1 0  mread.h
10 mread.c
@@ -305,8 +305,8 @@ _link_node(struct ringbuffer * rb, int id, struct socket * s , struct ringbuffer
305 305 }
306 306 }
307 307
308   -static void
309   -_close_client(struct mread_pool * self, int id) {
  308 +void
  309 +mread_close_client(struct mread_pool * self, int id) {
310 310 struct socket * s = &self->sockets[id];
311 311 s->status = SOCKET_CLOSED;
312 312 s->node = NULL;
@@ -324,7 +324,7 @@ _close_active(struct mread_pool * self) {
324 324 struct socket * s = &self->sockets[id];
325 325 ringbuffer_free(self->rb, s->temp);
326 326 ringbuffer_free(self->rb, s->node);
327   - _close_client(self, id);
  327 + mread_close_client(self, id);
328 328 }
329 329
330 330 static char *
@@ -375,7 +375,7 @@ mread_pull(struct mread_pool * self , int size) {
375 375 struct ringbuffer_block * blk = ringbuffer_alloc(rb , rd);
376 376 while (blk == NULL) {
377 377 int collect_id = ringbuffer_collect(rb);
378   - _close_client(self , collect_id);
  378 + mread_close_client(self , collect_id);
379 379 if (id == collect_id) {
380 380 return NULL;
381 381 }
@@ -427,7 +427,7 @@ mread_pull(struct mread_pool * self , int size) {
427 427 struct ringbuffer_block * temp = ringbuffer_alloc(rb, size);
428 428 while (temp == NULL) {
429 429 int collect_id = ringbuffer_collect(rb);
430   - _close_client(self , collect_id);
  430 + mread_close_client(self , collect_id);
431 431 if (id == collect_id) {
432 432 return NULL;
433 433 }
1  mread.h
@@ -9,6 +9,7 @@ void mread_close(struct mread_pool *m);
9 9 int mread_poll(struct mread_pool *m , int timeout);
10 10 void * mread_pull(struct mread_pool *m , int size);
11 11 void mread_yield(struct mread_pool *m);
  12 +void mread_close_client(struct mread_pool *m, int id);
12 13 int mread_closed(struct mread_pool *m);
13 14 int mread_socket(struct mread_pool *m , int index);
14 15

0 comments on commit 9f31245

Please sign in to comment.
Something went wrong with that request. Please try again.