PengZheng commented on code in PR #851:
URL: https://github.com/apache/celix/pull/851#discussion_r4240927568


##########
bundles/shell/remote_shell/src/remote_shell.c:
##########
@@ -172,27 +175,42 @@ void *remoteShell_connection_run(void *data) {
 
                /* The socket_fd has data available to be read */
                if (result > 0 && FD_ISSET(fd, &connection->pollset)) {
-                       char buff[COMMAND_BUFF_SIZE];
-
-                       len = recv(fd, buff, COMMAND_BUFF_SIZE - 1, 0);
-                       if (len < COMMAND_BUFF_SIZE) {
-                               celix_status_t commandStatus = CELIX_SUCCESS;
-                               buff[len] = '\0';
-
-                               commandStatus = 
remoteShell_connection_execute(connection, buff);
-
-                               if (commandStatus == CELIX_SUCCESS) {
-                                       
remoteShell_connection_print(connection, RS_PROMPT);
-                               } else if (commandStatus == 
CELIX_FILE_IO_EXCEPTION) {
-                                       //exit command
-                                       break;
-                               } else { //error
-                                       
remoteShell_connection_print(connection, RS_ERROR);
-                                       
remoteShell_connection_print(connection, RS_PROMPT);
+                       len = recv(fd, buff + used, COMMAND_BUFF_SIZE - 1 - 
used, 0);

Review Comment:
   This is still not robust enough. A common error breaking this is `EINTR`, 
which requires retry.
   Note `EINTR` is not the only such status code, `EAGAIN`/`EWOULDBLOCK` to 
name a few.
   We also need to take platform difference (macOS and Linux) into account.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to