mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine the macros for windows of srs-librtmp
This commit is contained in:
parent
15ae4745f4
commit
9387d09f5f
3 changed files with 78 additions and 60 deletions
|
@ -25,6 +25,34 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
#include <srs_kernel_error.hpp>
|
||||
|
||||
// for srs-librtmp, @see https://github.com/winlinvip/simple-rtmp-server/issues/213
|
||||
#ifndef _WIN32
|
||||
#define SOCKET_ETIME ETIME
|
||||
#define SOCKET_ECONNRESET ECONNRESET
|
||||
|
||||
#define SOCKET_ERRNO() errno
|
||||
#define SOCKET_RESET(fd) fd = -1; (void)0
|
||||
#define SOCKET_CLOSE(fd) \
|
||||
if (fd > 0) {\
|
||||
::close(fd); \
|
||||
fd = -1; \
|
||||
} \
|
||||
(void)0
|
||||
#define SOCKET_VALID(x) (x > 0)
|
||||
#define SOCKET_SETUP() (void)0
|
||||
#define SOCKET_CLEANUP() (void)0
|
||||
#else
|
||||
#define SOCKET_ETIME WSAETIMEDOUT
|
||||
#define SOCKET_ECONNRESET WSAECONNRESET
|
||||
#define SOCKET_ERRNO() WSAGetLastError()
|
||||
#define SOCKET_RESET(x) x=INVALID_SOCKET
|
||||
#define SOCKET_CLOSE(x) if(x!=INVALID_SOCKET){::closesocket(x);x=INVALID_SOCKET;}
|
||||
#define SOCKET_VALID(x) (x!=INVALID_SOCKET)
|
||||
#define SOCKET_BUFF(x) ((char*)x)
|
||||
#define SOCKET_SETUP() socket_setup()
|
||||
#define SOCKET_CLEANUP() socket_cleanup()
|
||||
#endif
|
||||
|
||||
// for srs-librtmp, @see https://github.com/winlinvip/simple-rtmp-server/issues/213
|
||||
#ifndef _WIN32
|
||||
#include <unistd.h>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue