Browse Source

Empty buffers of servers and proxy when killing them

master
Con Kolivas 10 years ago
parent
commit
fe7f015ec6
  1. 1
      src/ckpool.h
  2. 2
      src/generator.c

1
src/ckpool.h

@ -193,6 +193,7 @@ bool ckmsgq_empty(ckmsgq_t *ckmsgq);
ckpool_t *global_ckp; ckpool_t *global_ckp;
bool ping_main(ckpool_t *ckp); bool ping_main(ckpool_t *ckp);
void empty_buffer(connsock_t *cs);
int read_socket_line(connsock_t *cs, int timeout); int read_socket_line(connsock_t *cs, int timeout);
bool _send_proc(proc_instance_t *pi, const char *msg, const char *file, const char *func, const int line); bool _send_proc(proc_instance_t *pi, const char *msg, const char *file, const char *func, const int line);
#define send_proc(pi, msg) _send_proc(pi, msg, __FILE__, __func__, __LINE__) #define send_proc(pi, msg) _send_proc(pi, msg, __FILE__, __func__, __LINE__)

2
src/generator.c

@ -229,6 +229,7 @@ static void kill_server(server_instance_t *si)
LOGNOTICE("Killing server"); LOGNOTICE("Killing server");
cs = &si->cs; cs = &si->cs;
Close(cs->fd); Close(cs->fd);
empty_buffer(cs);
dealloc(cs->url); dealloc(cs->url);
dealloc(cs->port); dealloc(cs->port);
dealloc(cs->auth); dealloc(cs->auth);
@ -1452,6 +1453,7 @@ static void kill_proxy(ckpool_t *ckp, proxy_instance_t *proxi)
LOGNOTICE("Killing proxy"); LOGNOTICE("Killing proxy");
cs = proxi->cs; cs = proxi->cs;
Close(cs->fd); Close(cs->fd);
empty_buffer(cs);
/* All our notify data is invalid if we reconnect so discard them */ /* All our notify data is invalid if we reconnect so discard them */
mutex_lock(&proxi->notify_lock); mutex_lock(&proxi->notify_lock);

Loading…
Cancel
Save