trim headers and unused code in IXUdpSocket
This commit is contained in:
@ -7,59 +7,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <BaseTsd.h>
|
||||
typedef SSIZE_T ssize_t;
|
||||
|
||||
#undef EWOULDBLOCK
|
||||
#undef EAGAIN
|
||||
#undef EINPROGRESS
|
||||
#undef EBADF
|
||||
#undef EINVAL
|
||||
|
||||
// map to WSA error codes
|
||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#define EAGAIN WSATRY_AGAIN
|
||||
#define EINPROGRESS WSAEINPROGRESS
|
||||
#define EBADF WSAEBADF
|
||||
#define EINVAL WSAEINVAL
|
||||
|
||||
#endif
|
||||
|
||||
#include "IXCancellationRequest.h"
|
||||
#include "IXNetSystem.h"
|
||||
|
||||
namespace ix
|
||||
{
|
||||
class SelectInterrupt;
|
||||
|
||||
class UdpSocket
|
||||
{
|
||||
public:
|
||||
UdpSocket(int fd = -1);
|
||||
virtual ~UdpSocket();
|
||||
~UdpSocket();
|
||||
|
||||
// Virtual methods
|
||||
bool init(const std::string& host, int port, std::string& errMsg);
|
||||
ssize_t sendto(const std::string& buffer);
|
||||
virtual void close();
|
||||
void close();
|
||||
|
||||
static int getErrno();
|
||||
static bool isWaitNeeded();
|
||||
static void closeSocket(int fd);
|
||||
|
||||
protected:
|
||||
std::atomic<int> _sockfd;
|
||||
std::mutex _socketMutex;
|
||||
|
||||
struct sockaddr_in _server;
|
||||
|
||||
private:
|
||||
std::shared_ptr<SelectInterrupt> _selectInterrupt;
|
||||
std::atomic<int> _sockfd;
|
||||
struct sockaddr_in _server;
|
||||
};
|
||||
} // namespace ix
|
||||
|
Reference in New Issue
Block a user