Skip to content

Commit

Permalink
Do not reset buffer with every call to the read callback.
Browse files Browse the repository at this point in the history
  • Loading branch information
hoehermann committed Jul 9, 2023
1 parent 1de71ce commit 3b1e1d8
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/comms.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ signald_read_cb(gpointer data, gint source, PurpleInputCondition cond)
// this function essentially just reads bytes into a buffer until a newline is reached
// apparently, this callback is executed every 8k butes. therefore, input_buffer must be persistent accross calls
// using getline would be cool, but I do not want to find out what happens if I wrap this fd into a FILE* while the purple handle is connected to it
sa->input_buffer_position = sa->input_buffer;
gssize read = recv(sa->fd, sa->input_buffer_position, 1, sa->readflags); // read one byte at a time
while (read > 0) {
sa->input_buffer_position += read;
Expand Down

0 comments on commit 3b1e1d8

Please sign in to comment.