diff options
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -89,17 +89,19 @@ static bool client_socket_callback(int fd){ } data->buflen+=ret; - char *lfp=memchr(data->buffer,'\n',data->buflen); - if(lfp==NULL)return false; - size_t length=lfp-data->buffer; - bool should_close=handle_input_line(data,data->buffer,length); - memmove(data->buffer,lfp+1,data->buflen-length-1); - data->buflen-=length+1; - - if(should_close){ - delete_conn_data(fd); - close(fd); - return true; + while(true){ + char *lfp=memchr(data->buffer,'\n',data->buflen); + if(lfp==NULL)break; + size_t length=lfp-data->buffer; + bool should_close=handle_input_line(data,data->buffer,length); + memmove(data->buffer,lfp+1,data->buflen-length-1); + data->buflen-=length+1; + + if(should_close){ + delete_conn_data(fd); + close(fd); + return true; + } } return false; } |