diff options
| -rw-r--r-- | main.c | 22 | 
1 files changed, 12 insertions, 10 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; +	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; +		if(should_close){ +			delete_conn_data(fd); +			close(fd); +			return true; +		}  	}  	return false;  } | 
