version 1.156, 2015/10/20 14:19:27 |
version 1.157, 2015/10/20 21:12:09 |
|
|
evtimer_set(&c->repeat_timer, server_client_repeat_timer, c); |
evtimer_set(&c->repeat_timer, server_client_repeat_timer, c); |
|
|
TAILQ_INSERT_TAIL(&clients, c, entry); |
TAILQ_INSERT_TAIL(&clients, c, entry); |
log_debug("new client %d", fd); |
log_debug("new client %p", c); |
} |
} |
|
|
/* Open client terminal if needed. */ |
/* Open client terminal if needed. */ |
|
|
c->stdin_callback(c, 1, c->stdin_callback_data); |
c->stdin_callback(c, 1, c->stdin_callback_data); |
|
|
TAILQ_REMOVE(&clients, c, entry); |
TAILQ_REMOVE(&clients, c, entry); |
log_debug("lost client %d", c->ibuf.fd); |
log_debug("lost client %p", c); |
|
|
/* |
/* |
* If CLIENT_TERMINAL hasn't been set, then tty_init hasn't been called |
* If CLIENT_TERMINAL hasn't been set, then tty_init hasn't been called |
|
|
void |
void |
server_client_unref(struct client *c) |
server_client_unref(struct client *c) |
{ |
{ |
log_debug("unref client %d (%d references)", c->ibuf.fd, c->references); |
log_debug("unref client %p (%d references)", c, c->references); |
|
|
c->references--; |
c->references--; |
if (c->references == 0) |
if (c->references == 0) |
|
|
{ |
{ |
struct client *c = arg; |
struct client *c = arg; |
|
|
log_debug("free client %d (%d references)", c->ibuf.fd, c->references); |
log_debug("free client %p (%d references)", c, c->references); |
|
|
if (c->references == 0) |
if (c->references == 0) |
free(c); |
free(c); |
|
|
continue; |
continue; |
} |
} |
|
|
log_debug("got %u from client %d", imsg.hdr.type, c->ibuf.fd); |
log_debug("got %u from client %p", imsg.hdr.type, c); |
switch (imsg.hdr.type) { |
switch (imsg.hdr.type) { |
case MSG_IDENTIFY_FLAGS: |
case MSG_IDENTIFY_FLAGS: |
case MSG_IDENTIFY_TERM: |
case MSG_IDENTIFY_TERM: |