From c55d579e2ddf7c812744e78ca9fb86b1c5a563b4 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Mon, 17 Jun 2019 08:04:49 +0300
Subject: [PATCH] Remove TCP_NODELAY and debug deadlock

---
 components/net/cpp/src/peer.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/components/net/cpp/src/peer.cpp b/components/net/cpp/src/peer.cpp
index 1c87fdf9e..967753b56 100644
--- a/components/net/cpp/src/peer.cpp
+++ b/components/net/cpp/src/peer.cpp
@@ -85,8 +85,8 @@ static SOCKET tcpConnect(URI &uri) {
 		return INVALID_SOCKET;
 	}
 
-	int flags =1; 
-    if (setsockopt(csocket, IPPROTO_TCP, TCP_NODELAY, (const char *)&flags, sizeof(flags))) { LOG(ERROR) << "ERROR: setsocketopt(), TCP_NODELAY"; };
+	//int flags =1; 
+    //if (setsockopt(csocket, IPPROTO_TCP, TCP_NODELAY, (const char *)&flags, sizeof(flags))) { LOG(ERROR) << "ERROR: setsocketopt(), TCP_NODELAY"; };
 
 	addrinfo hints = {}, *addrs;
 	hints.ai_family = AF_INET;
@@ -169,8 +169,8 @@ Peer::Peer(SOCKET s, Universe *u, Dispatcher *d) : sock_(s), can_reconnect_(fals
 	is_waiting_ = true;
 	scheme_ = ftl::URI::SCHEME_TCP;
 
-	int flags =1; 
-    if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (const char *)&flags, sizeof(flags))) { LOG(ERROR) << "ERROR: setsocketopt(), TCP_NODELAY"; };
+	//int flags =1; 
+    //if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (const char *)&flags, sizeof(flags))) { LOG(ERROR) << "ERROR: setsocketopt(), TCP_NODELAY"; };
 	
 	// Send the initiating handshake if valid
 	if (status_ == kConnecting) {
@@ -602,7 +602,9 @@ int Peer::_send() {
 	}
 
 	DWORD bytessent;
+	LOG(INFO) << "About to send: " << send_size;
 	int c = WSASend(sock_, wsabuf.data(), send_size, (LPDWORD)&bytessent, 0, NULL, NULL);
+	LOG(INFO) << "Fin send";
 #else
 	int c = ftl::net::internal::writev(sock_, send_buf_.vector(), (int)send_buf_.vector_size());
 #endif
-- 
GitLab