#include "tcp_socket.h"
-#define LOG_LEVEL LOG_LVL_INFO
-#define LOG_FORMAT LOG_FMT_TERSE
+#include "cfg/cfg_tcpsocket.h"
+
+#define LOG_LEVEL TCPSOCKET_LOG_LEVEL
+#define LOG_FORMAT TCPSOCKET_LOG_FORMAT
#include <cfg/log.h>
#include <cpu/byteorder.h>
return NULL;
}
+/*
+ * Read data from socket.
+ *
+ * The read return the bytes that had been received if they are less than we request too.
+ * Otherwise if the byte that we want read are less that the received bytes, we return only
+ * the requested bytes. To get the remaning bytes we need to make an others read, until the
+ * buffer is empty.
+ * When there are not any more bytes, a new read takes data from remote socket.
+ */
static size_t tcpsocket_read(KFile *fd, void *buf, size_t len)
{
TcpSocket *socket = TCPSOCKET_CAST(fd);
}
/* Try reconnecting if our socket isn't valid */
- LOG_INFO("sock[%s]\n", socket->sock ? "valido":"nullo");
if (!socket->sock && !tcpsocket_reconnect(socket))
return 0;
- LOG_INFO("sock1[%s]\n", socket->sock ? "valido":"nullo");
while (len)
{