diff options
Diffstat (limited to 'src/daemon')
-rw-r--r-- | src/daemon/dlt_daemon_client.c | 28 | ||||
-rw-r--r-- | src/daemon/dlt_daemon_connection.c | 5 | ||||
-rw-r--r-- | src/daemon/dlt_daemon_socket.c | 12 | ||||
-rw-r--r-- | src/daemon/dlt_daemon_socket.h | 2 |
4 files changed, 6 insertions, 41 deletions
diff --git a/src/daemon/dlt_daemon_client.c b/src/daemon/dlt_daemon_client.c index 55afd7c..d8062d5 100644 --- a/src/daemon/dlt_daemon_client.c +++ b/src/daemon/dlt_daemon_client.c @@ -113,7 +113,6 @@ static int dlt_daemon_client_send_all_multiple(DltDaemon *daemon, DltConnection *temp = NULL; int type_mask = (DLT_CON_MASK_CLIENT_MSG_TCP | DLT_CON_MASK_CLIENT_MSG_SERIAL); - uint8_t *tmp_buffer = NULL; if ((daemon == NULL) || (daemon_local == NULL)) { dlt_vlog(LOG_ERR, "%s: Invalid parameters\n", __func__); @@ -142,33 +141,6 @@ static int dlt_daemon_client_send_all_multiple(DltDaemon *daemon, if ((ret != DLT_DAEMON_ERROR_OK) && (DLT_CONNECTION_CLIENT_MSG_TCP == temp->type)) { - if (daemon->state != DLT_DAEMON_STATE_BUFFER_FULL) { - if (temp->receiver->bytes_sent < (size1 + size2)) { - tmp_buffer = (uint8_t *)calloc(size1 + size2, sizeof(uint8_t)); - - if (tmp_buffer == NULL) { - dlt_vlog(LOG_ERR, "%s: Memory allocation failed.\n", __func__); - return 0; - } - - memcpy(tmp_buffer, data1, size1); - memcpy(tmp_buffer + size1, data2, size2); - DLT_DAEMON_SEM_LOCK(); - - /* Store message in history buffer */ - if (dlt_buffer_push3(&(daemon->client_ringbuffer), - tmp_buffer + temp->receiver->bytes_sent, - (size1 + size2 - temp->receiver->bytes_sent), - 0, 0, 0, 0) < DLT_RETURN_OK) { - dlt_vlog(LOG_DEBUG, "%s: Buffer is full! Message discarded.\n", __func__); - dlt_daemon_change_state(daemon, DLT_DAEMON_STATE_BUFFER_FULL); - } - - free(tmp_buffer); - DLT_DAEMON_SEM_FREE(); - } - } - dlt_daemon_close_socket(temp->receiver->fd, daemon, daemon_local, diff --git a/src/daemon/dlt_daemon_connection.c b/src/daemon/dlt_daemon_connection.c index 2fe17c1..456a075 100644 --- a/src/daemon/dlt_daemon_connection.c +++ b/src/daemon/dlt_daemon_connection.c @@ -71,7 +71,6 @@ DLT_STATIC int dlt_connection_send(DltConnection *conn, size_t msg_size) { DltConnectionType type = DLT_CONNECTION_TYPE_MAX; - int bytes_sent = 0; int ret = 0; if ((conn != NULL) && (conn->receiver != NULL)) @@ -88,9 +87,7 @@ DLT_STATIC int dlt_connection_send(DltConnection *conn, case DLT_CONNECTION_CLIENT_MSG_TCP: ret = dlt_daemon_socket_sendreliable(conn->receiver->fd, msg, - msg_size, - &bytes_sent); - conn->receiver->bytes_sent += bytes_sent; + msg_size); return ret; default: return DLT_DAEMON_ERROR_UNKNOWN; diff --git a/src/daemon/dlt_daemon_socket.c b/src/daemon/dlt_daemon_socket.c index f35346d..f9c4ab2 100644 --- a/src/daemon/dlt_daemon_socket.c +++ b/src/daemon/dlt_daemon_socket.c @@ -152,14 +152,12 @@ int dlt_daemon_socket_close(int sock) int dlt_daemon_socket_send(int sock, void *data1, int size1, void *data2, int size2, char serialheader) { int ret = DLT_RETURN_OK; - int bytes_sent = 0; /* Optional: Send serial header, if requested */ if (serialheader) { ret = dlt_daemon_socket_sendreliable(sock, (void *)dltSerialHeader, - sizeof(dltSerialHeader), - &bytes_sent); + sizeof(dltSerialHeader)); if (ret != DLT_RETURN_OK) return ret; @@ -167,14 +165,14 @@ int dlt_daemon_socket_send(int sock, void *data1, int size1, void *data2, int si /* Send data */ if ((data1 != NULL) && (size1 > 0)) { - ret = dlt_daemon_socket_sendreliable(sock, data1, size1, &bytes_sent); + ret = dlt_daemon_socket_sendreliable(sock, data1, size1); if (ret != DLT_RETURN_OK) return ret; } if ((data2 != NULL) && (size2 > 0)) - ret = dlt_daemon_socket_sendreliable(sock, data2, size2, &bytes_sent); + ret = dlt_daemon_socket_sendreliable(sock, data2, size2); return ret; } @@ -188,7 +186,7 @@ int dlt_daemon_socket_get_send_qeue_max_size(int sock) return n; } -int dlt_daemon_socket_sendreliable(int sock, void *data_buffer, int message_size, int *bytes_sent) +int dlt_daemon_socket_sendreliable(int sock, void *data_buffer, int message_size) { int data_sent = 0; @@ -199,7 +197,6 @@ int dlt_daemon_socket_sendreliable(int sock, void *data_buffer, int message_size dlt_vlog(LOG_WARNING, "dlt_daemon_socket_sendreliable: socket send failed [errno: %d]!\n", errno); - *bytes_sent = data_sent; return DLT_DAEMON_ERROR_SEND_FAILED; } else { @@ -207,7 +204,6 @@ int dlt_daemon_socket_sendreliable(int sock, void *data_buffer, int message_size } } - *bytes_sent = data_sent; return DLT_DAEMON_ERROR_OK; } diff --git a/src/daemon/dlt_daemon_socket.h b/src/daemon/dlt_daemon_socket.h index 7276b2d..a9ac008 100644 --- a/src/daemon/dlt_daemon_socket.h +++ b/src/daemon/dlt_daemon_socket.h @@ -76,6 +76,6 @@ int dlt_daemon_socket_send(int sock, void *data1, int size1, void *data2, int si * @param message_size * @return on sucess: DLT_DAEMON_ERROR_OK, on error: DLT_DAEMON_ERROR_SEND_FAILED */ -int dlt_daemon_socket_sendreliable(int sock, void *data_buffer, int message_size, int *bytes_sent); +int dlt_daemon_socket_sendreliable(int sock, void *data_buffer, int message_size); #endif /* DLT_DAEMON_SOCKET_H */ |