mirror of
https://github.com/pocoproject/poco.git
synced 2026-01-12 00:04:54 +08:00
fix(Net): Add POCO_HAS_UNIX_SOCKET guards to fix build without Unix sockets #5064
This commit is contained in:
@@ -54,7 +54,7 @@
|
||||
|
||||
#include "Poco/Data/ODBC/Unicode.h"
|
||||
|
||||
#if (__cplusplus >= 201703L)
|
||||
#if POCO_HAVE_CPP17_COMPILER
|
||||
#if __has_include(<msodbcsql.h>)
|
||||
#include <msodbcsql.h>
|
||||
#define POCO_DATA_ODBC_HAVE_SQL_SERVER_EXT
|
||||
|
||||
@@ -32,16 +32,6 @@
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// Thread-safety of local static initialization
|
||||
//
|
||||
#if __cplusplus >= 201103L || __GNUC__ >= 4 || defined(__clang__)
|
||||
#ifndef POCO_LOCAL_STATIC_INIT_IS_THREADSAFE
|
||||
#define POCO_LOCAL_STATIC_INIT_IS_THREADSAFE 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// No syslog.h on QNX/BB10
|
||||
//
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#define Net_SocketDefs_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Config.h"
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -33,7 +34,7 @@
|
||||
#include <ws2tcpip.h>
|
||||
#include <ws2def.h>
|
||||
#if !defined (POCO_NET_NO_UNIX_SOCKET)
|
||||
#if (__cplusplus >= 201703L)
|
||||
#if POCO_HAVE_CPP17_COMPILER
|
||||
#if __has_include(<afunix.h>)
|
||||
#include <afunix.h>
|
||||
#define POCO_HAS_UNIX_SOCKET
|
||||
|
||||
@@ -196,7 +196,9 @@ void HTTPSession::connect(const SocketAddress& address)
|
||||
_socket.connect(address, _connectionTimeout);
|
||||
_socket.setReceiveTimeout(_receiveTimeout);
|
||||
_socket.setSendTimeout(_sendTimeout);
|
||||
#if defined(POCO_HAS_UNIX_SOCKET)
|
||||
if (address.family() != SocketAddress::UNIX_LOCAL)
|
||||
#endif
|
||||
_socket.setNoDelay(true);
|
||||
// There may be leftover data from a previous (failed) request in the buffer,
|
||||
// so we clear it.
|
||||
|
||||
@@ -380,11 +380,13 @@ void SocketAddress::init(const std::string& hostAndPort)
|
||||
{
|
||||
poco_assert (!hostAndPort.empty());
|
||||
|
||||
#if defined(POCO_HAS_UNIX_SOCKET)
|
||||
if (isUnixLocal(hostAndPort))
|
||||
{
|
||||
newLocal(hostAndPort);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
std::string host;
|
||||
std::string port;
|
||||
|
||||
@@ -47,7 +47,9 @@ WebSocketImpl::WebSocketImpl(StreamSocketImpl* pStreamSocketImpl, HTTPSession& s
|
||||
// for small WebSocket frames. Skip for Unix domain sockets.
|
||||
try
|
||||
{
|
||||
#if defined(POCO_HAS_UNIX_SOCKET)
|
||||
if (_pStreamSocketImpl->address().family() != SocketAddress::UNIX_LOCAL)
|
||||
#endif
|
||||
_pStreamSocketImpl->setNoDelay(true);
|
||||
}
|
||||
catch (NetException&)
|
||||
|
||||
Reference in New Issue
Block a user