void buffer_check_flush(struct delta_stream* stream) { for (int i=0;i<NUM_BUFFERS;i++) { if (stream->buffers[i].offset > MAX_BUFFER_SIZE - 8) { buffer_flush_all(stream); return; } } }
static int client_data(struct osmo_fd *fd, unsigned int what) { struct telnet_connection *conn = fd->data; int rc = 0; if (what & BSC_FD_READ) { conn->fd.when &= ~BSC_FD_READ; rc = vty_read(conn->vty); } /* vty might have been closed from vithin vty_read() */ if (!conn->vty) return rc; if (what & BSC_FD_WRITE) { rc = buffer_flush_all(conn->vty->obuf, fd->fd); if (rc == BUFFER_EMPTY) conn->fd.when &= ~BSC_FD_WRITE; } return rc; }