summaryrefslogtreecommitdiff
path: root/netcon
diff options
context:
space:
mode:
Diffstat (limited to 'netcon')
-rw-r--r--netcon/Intercept.c5
-rw-r--r--netcon/NetconEthernetTap.cpp2
-rw-r--r--netcon/common.inc.c8
3 files changed, 8 insertions, 7 deletions
diff --git a/netcon/Intercept.c b/netcon/Intercept.c
index 2830c3ac..ad48b7d4 100644
--- a/netcon/Intercept.c
+++ b/netcon/Intercept.c
@@ -138,7 +138,7 @@ static void checkpid()
return;
if (thispid != getpid()) {
- printf("clone/fork detected. re-initializing this instance.\n");
+ dwr(MSG_DEBUG, "checkpid(): clone/fork detected. Re-initializing this instance.\n");
set_up_intercept();
fdret_sock = init_service_connection();
thispid = getpid();
@@ -216,12 +216,11 @@ static int send_cmd(int rpc_fd, char *cmd)
#endif
/* Combine command flag+payload with RPC metadata */
memcpy(&metabuf[IDX_PAYLOAD], cmd, PAYLOAD_SZ);
- usleep(1000);
+ usleep(100000);
int n_write = write(rpc_fd, &metabuf, BUF_SZ);
if(n_write < 0){
dwr(MSG_DEBUG,"Error writing command to service (CMD = %d)\n", cmd[0]);
errno = 0;
- return -1;
}
int ret = ERR_OK;
diff --git a/netcon/NetconEthernetTap.cpp b/netcon/NetconEthernetTap.cpp
index 609e2923..cb5def32 100644
--- a/netcon/NetconEthernetTap.cpp
+++ b/netcon/NetconEthernetTap.cpp
@@ -848,6 +848,8 @@ err_t NetconEthernetTap::nc_accept(void *arg, struct tcp_pcb *newpcb, err_t err)
dwr(MSG_DEBUG, " nc_accept(): socketpair = {%d, %d}\n", fds[0], fds[1]);
int send_fd = tap->_phy.getDescriptor(conn->rpcSock);
+dwr(MSG_DEBUG, "nc_accept(): sending %d via %d\n", fds[1], listening_fd);
+
if(sock_fd_write(listening_fd, fds[1]) < 0){
dwr(MSG_ERROR, " nc_accept(%d): error writing signal byte (listen_fd = %d, perceived_fd = %d)\n", listening_fd, send_fd, fds[1]);
return -1;
diff --git a/netcon/common.inc.c b/netcon/common.inc.c
index 0523f104..71761b20 100644
--- a/netcon/common.inc.c
+++ b/netcon/common.inc.c
@@ -39,9 +39,9 @@
#include <fcntl.h>
-#define DEBUG_LEVEL 0
+#define DEBUG_LEVEL 4
-#define MSG_WARNING 0
+#define MSG_WARNING 4
#define MSG_ERROR 1 // Errors
#define MSG_INFO 2 // Information which is generally useful to any user
#define MSG_DEBUG 3 // Information which is only useful to someone debugging
@@ -171,7 +171,7 @@ static ssize_t sock_fd_read(int sock, void *buf, ssize_t bufsize, int *fd)
msg.msg_controllen = sizeof(cmsgu.control);
size = recvmsg (sock, &msg, 0);
if (size < 0) {
- perror ("recvmsg");
+ dwr(MSG_DEBUG, "sock_fd_read(): recvmsg: Error\n");
return -1;
}
cmsg = CMSG_FIRSTHDR(&msg);
@@ -190,7 +190,7 @@ static ssize_t sock_fd_read(int sock, void *buf, ssize_t bufsize, int *fd)
} else {
size = read (sock, buf, bufsize);
if (size < 0) {
- perror("read");
+ dwr(MSG_DEBUG, "sock_fd_read(): read: Error\n");
return -1;
}
}