Skip to content
Snippets Groups Projects
sockcopy.cpp 1.1 KiB
Newer Older
  • Learn to ignore specific revisions
  • #include "sockcopy.hpp"
    
    namespace netlib
    {
    
    
    
    Daniel Müller's avatar
    Daniel Müller committed
    SockCopy<TcpStream> wrapCopy(TcpStream & other, bool disableAutoclose)
    
    {
        if (disableAutoclose) other.setAutoclose(false);
        return SockCopy<TcpStream>(other);
    }
    
    
    Daniel Müller's avatar
    Daniel Müller committed
    SockCopy<TcpListener> wrapCopy(TcpListener & other, bool disableAutoclose)
    
    {
        if (disableAutoclose) other.setAutoclose(false);
        return SockCopy<TcpListener>(other);
    }
    
    
    Daniel Müller's avatar
    Daniel Müller committed
    SockCopy<UdpSocket> wrapCopy(UdpSocket & other, bool disableAutoclose)
    
    {
        if (disableAutoclose) other.setAutoclose(false);
        return SockCopy<UdpSocket>(other);
    }
    
    
    
    Daniel Müller's avatar
    Daniel Müller committed
    SockCopy<TcpStream> wrapCopy(TcpStream && other, bool disableAutoclose)
    
    {
        if (disableAutoclose) other.setAutoclose(false);
        return SockCopy<TcpStream>(std::move(other));
    }
    
    
    Daniel Müller's avatar
    Daniel Müller committed
    SockCopy<TcpListener> wrapCopy(TcpListener && other, bool disableAutoclose)
    
    {
        if (disableAutoclose) other.setAutoclose(false);
        return SockCopy<TcpListener>(std::move(other));
    }
    
    
    Daniel Müller's avatar
    Daniel Müller committed
    SockCopy<UdpSocket> wrapCopy(UdpSocket && other, bool disableAutoclose)
    
    {
        if (disableAutoclose) other.setAutoclose(false);
        return SockCopy<UdpSocket>(std::move(other));
    }
    
    
    } // namespace netlib