Skip to content

Commit

Permalink
avoid close socket duplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwu committed Jun 6, 2013
1 parent 438676c commit a06fca2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions gate/mread.c
Original file line number Diff line number Diff line change
Expand Up @@ -580,16 +580,20 @@ _link_node(struct ringbuffer * rb, int id, struct socket * s , struct ringbuffer
void
mread_close_client(struct mread_pool * self, int id) {
struct socket * s = &self->sockets[id];
s->status = SOCKET_HALFCLOSE;
try_close(self,s);
if (s->status >= SOCKET_ALIVE && s->status != SOCKET_HALFCLOSE) {
s->status = SOCKET_HALFCLOSE;
try_close(self, s);
}
}

static void
force_close_client(struct mread_pool * self, int id) {
struct socket * s = &self->sockets[id];
free_buffer(&s->client);
s->status = SOCKET_HALFCLOSE;
try_close(self, s);
if (s->status >= SOCKET_ALIVE && s->status != SOCKET_HALFCLOSE) {
s->status = SOCKET_HALFCLOSE;
try_close(self, s);
}
}

static void
Expand Down

0 comments on commit a06fca2

Please sign in to comment.