fix ws curl error message + some Windows warnings

This commit is contained in:
Benjamin Sergeant 2020-12-12 11:00:55 -08:00
parent 2fac4bd9ef
commit 93ad709dfd
6 changed files with 12 additions and 5 deletions

View File

@ -31,7 +31,7 @@ namespace ix
int getAnyFreePort()
{
int sockfd;
socket_t sockfd;
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
{
return getAnyFreePortRandom();

View File

@ -45,7 +45,7 @@ namespace ix
int poll(struct pollfd* fds, nfds_t nfds, int timeout)
{
#ifdef _WIN32
int maxfd = 0;
socket_t maxfd = 0;
fd_set readfds, writefds, errorfds;
FD_ZERO(&readfds);
FD_ZERO(&writefds);

View File

@ -34,6 +34,12 @@ typedef unsigned long int nfds_t;
namespace ix
{
#ifdef _WIN32
typedef SOCKET socket_t;
#else
typedef int socket_t;
#endif
bool initNetSystem();
bool uninitNetSystem();

View File

@ -35,7 +35,7 @@ namespace ix
{
errMsg = "no error";
int fd = socket(address->ai_family, address->ai_socktype, address->ai_protocol);
socket_t fd = socket(address->ai_family, address->ai_socktype, address->ai_protocol);
if (fd < 0)
{
errMsg = "Cannot create a socket";

View File

@ -9,6 +9,7 @@
#include "IXConnectionState.h"
#include "IXSelectInterrupt.h"
#include "IXSocketTLSOptions.h"
#include "IXNetSystem.h"
#include <atomic>
#include <condition_variable>
#include <functional>
@ -75,7 +76,7 @@ namespace ix
int _addressFamily;
// socket for accepting connections
int _serverFd;
socket_t _serverFd;
std::atomic<bool> _stop;

View File

@ -1620,7 +1620,7 @@ namespace ix
spdlog::info("Status: {}", response->statusCode);
if (response->errorCode != HttpErrorCode::Ok)
{
spdlog::info("error message: ", response->errorMsg);
spdlog::error("error message: {}", response->errorMsg);
}
if (!headersOnly && response->errorCode == HttpErrorCode::Ok)