Attempt to make cygwin compiles work again

This commit is contained in:
Thulinma 2020-10-23 20:09:59 +02:00
parent 072e037023
commit 6307428476
3 changed files with 11 additions and 4 deletions

View file

@ -9,7 +9,7 @@ if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++98")
SET(SOURCE_DIR ${PROJECT_SOURCE_DIR})
SET(BINARY_DIR ${PROJECT_BINARY_DIR})

View file

@ -1583,7 +1583,11 @@ Socket::UDPConnection::UDPConnection(bool nonblock){
down = 0;
destAddr = 0;
destAddr_size = 0;
#ifdef __CYGWIN__
data.allocate(SOCKETSIZE);
#else
data.allocate(2048);
#endif
}// Socket::UDPConnection UDP Contructor
///Checks if the UDP receive buffer is at least 1 mbyte, attempts to increase and warns user through log message on failure.
@ -1599,23 +1603,27 @@ void Socket::UDPConnection::checkRecvBuf(){
setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, sizeof(recvbuf));
slen = sizeof(recvbuf);
getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, &slen);
#ifndef __CYGWIN__
if (recvbuf < 1024*1024){
recvbuf = 1024*1024;
setsockopt(sock, SOL_SOCKET, SO_RCVBUFFORCE, (void*)&recvbuf, sizeof(recvbuf));
slen = sizeof(recvbuf);
getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, &slen);
}
#endif
if (recvbuf < 200*1024){
recvbuf = 200*1024;
setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, sizeof(recvbuf));
slen = sizeof(recvbuf);
getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, &slen);
#ifndef __CYGWIN__
if (recvbuf < 200*1024){
recvbuf = 200*1024;
setsockopt(sock, SOL_SOCKET, SO_RCVBUFFORCE, (void*)&recvbuf, sizeof(recvbuf));
slen = sizeof(recvbuf);
getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, &slen);
}
#endif
}
if (recvbuf < 200*1024){
WARN_MSG("Your UDP receive buffer is set < 200 kbyte (%db) and the kernel denied our request for an increase. It's recommended to set your net.core.rmem_max setting to at least 200 kbyte for best results.", origbuf);
@ -1996,9 +2004,6 @@ uint16_t Socket::UDPConnection::bind(int port, std::string iface, const std::str
/// \return True if a packet was received, false otherwise.
bool Socket::UDPConnection::Receive(){
if (sock == -1){return false;}
#ifdef __CYGWIN__
data.allocate((SOCKETSIZE);
#endif
data.truncate(0);
socklen_t destsize = destAddr_size;
int r = recvfrom(sock, data, data.rsize(), MSG_TRUNC | MSG_DONTWAIT, (sockaddr *)destAddr, &destsize);

View file

@ -282,6 +282,7 @@ namespace Mist{
/// \TODO META Re-Implement for Cygwin/Win32!
#if defined(__CYGWIN__) || defined(_WIN32)
/*
static int wipedAlready = 0;
if (lowest && lowest > wipedAlready + 1){
for (int curr = wipedAlready + 1; curr < lowest; ++curr){
@ -292,6 +293,7 @@ namespace Mist{
}
// Print a message about registering the page or not.
if (inserted){IPC::preservePage(curPage[idx].name);}
*/
#endif
// Close our link to the page. This will NOT destroy the shared page, as we've set master to
// false upon construction Note: if there was a registering failure above, this WILL destroy the