client: more assertions
This commit is contained in:
parent
4e17ab11a8
commit
08c9de7b68
@ -146,6 +146,8 @@ static void client_init(struct client *client, int fd)
|
|||||||
{
|
{
|
||||||
static unsigned int next_client_num;
|
static unsigned int next_client_num;
|
||||||
|
|
||||||
|
assert(fd >= 0);
|
||||||
|
|
||||||
client->cmd_list_size = 0;
|
client->cmd_list_size = 0;
|
||||||
client->cmd_list_dup = 0;
|
client->cmd_list_dup = 0;
|
||||||
client->cmd_list_OK = -1;
|
client->cmd_list_OK = -1;
|
||||||
@ -635,6 +637,8 @@ static void client_write_deferred(struct client *client)
|
|||||||
|
|
||||||
buf = client->deferred_send;
|
buf = client->deferred_send;
|
||||||
while (buf) {
|
while (buf) {
|
||||||
|
assert(buf->size > 0);
|
||||||
|
|
||||||
ret = write(client->fd, buf->data, buf->size);
|
ret = write(client->fd, buf->data, buf->size);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
break;
|
break;
|
||||||
@ -718,6 +722,7 @@ static void client_defer_output(struct client *client,
|
|||||||
{
|
{
|
||||||
struct sllnode **buf_r;
|
struct sllnode **buf_r;
|
||||||
|
|
||||||
|
assert(length > 0);
|
||||||
assert(client->deferred_send != NULL);
|
assert(client->deferred_send != NULL);
|
||||||
|
|
||||||
client->deferred_bytes += sizeof(struct sllnode) + length;
|
client->deferred_bytes += sizeof(struct sllnode) + length;
|
||||||
@ -743,6 +748,7 @@ static void client_write(struct client *client,
|
|||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
|
||||||
|
assert(length > 0);
|
||||||
assert(client->deferred_send == NULL);
|
assert(client->deferred_send == NULL);
|
||||||
|
|
||||||
if ((ret = write(client->fd, data, length)) < 0) {
|
if ((ret = write(client->fd, data, length)) < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user