avoid close socket duplicate

This commit is contained in:
云风
2013-06-06 14:30:00 +08:00
parent 438676c703
commit a06fca2ef6

View File

@@ -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