struct para_buffer pb = {.flags = 0};
struct para_buffer pfpb = {.flags = PBF_SIZE_PREFIX};
const uint64_t one = 1;
+ char *msg = stat_item_values[item_num];
+ struct para_buffer *b;
list_for_each_entry_safe(sc, tmp, &client_list, node) {
int fd = sc->fd, ret;
if (!((one << item_num) & sc->item_mask))
continue;
- if (write_ok(fd) > 0) {
- struct para_buffer *b =
- (sc->flags & SCF_PARSER_FRIENDLY)? &pfpb : &pb;
- char *msg = stat_item_values[item_num];
- if (!b->buf)
- (void)WRITE_STATUS_ITEM(b, item_num, "%s\n",
- msg? msg : "");
- ret = write(fd, b->buf, b->offset);
- if (ret == b->offset)
- continue;
- }
- /* write error or fd not ready for writing */
+ b = (sc->flags & SCF_PARSER_FRIENDLY)? &pfpb : &pb;
+ if (!b->buf)
+ (void)WRITE_STATUS_ITEM(b, item_num, "%s\n",
+ msg? msg : "");
+ ret = write(fd, b->buf, b->offset);
+ if (ret == b->offset)
+ continue;
+ /* write error or short write */
close(fd);
num_clients--;
PARA_INFO_LOG("deleting client on fd %d\n", fd);
}
free(pb.buf);
free(pfpb.buf);
-// if (num_clients)
-// PARA_DEBUG_LOG("%d client(s)\n", num_clients);
}
/**
const uint64_t one = 1;
struct para_buffer b = {.flags = 0};
+ ret = mark_fd_nonblocking(fd);
+ if (ret < 0)
+ return ret;
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
if (arg[0] != '-')