1
Copyright (C) 2009 Laurent Aimar.
2
Licensed under GNU General Public License version 2 or higher.
3
diff -ur live/BasicUsageEnvironment/BasicTaskScheduler.cpp live-fix/BasicUsageEnvironment/BasicTaskScheduler.cpp
4
--- live/BasicUsageEnvironment/BasicTaskScheduler.cpp 2009-04-07 04:18:59.000000000 +0200
5
+++ live-fix/BasicUsageEnvironment/BasicTaskScheduler.cpp 2009-04-16 00:33:19.000000000 +0200
7
int dummySocketNum = socket(AF_INET, SOCK_DGRAM, 0);
8
FD_SET((unsigned)dummySocketNum, &fReadSet);
13
if (errno != EINTR && errno != EAGAIN) {
15
diff -ur live/BasicUsageEnvironment/BasicUsageEnvironment.cpp live-fix/BasicUsageEnvironment/BasicUsageEnvironment.cpp
16
--- live/BasicUsageEnvironment/BasicUsageEnvironment.cpp 2009-04-07 04:18:59.000000000 +0200
17
+++ live-fix/BasicUsageEnvironment/BasicUsageEnvironment.cpp 2009-04-16 00:30:33.000000000 +0200
22
+int BasicUsageEnvironment::getNetErrno() const {
23
+#if defined(__WIN32__) || defined(_WIN32)
25
+ errno = WSAGetLastError();
28
+#if defined(_WIN32_WCE)
29
+ return WSAGetLastError();
36
UsageEnvironment& BasicUsageEnvironment::operator<<(char const* str) {
37
fprintf(stderr, "%s", str);
39
diff -ur live/BasicUsageEnvironment/include/BasicUsageEnvironment.hh live-fix/BasicUsageEnvironment/include/BasicUsageEnvironment.hh
40
--- live/BasicUsageEnvironment/include/BasicUsageEnvironment.hh 2009-04-07 04:18:59.000000000 +0200
41
+++ live-fix/BasicUsageEnvironment/include/BasicUsageEnvironment.hh 2009-04-16 00:30:33.000000000 +0200
44
// redefined virtual functions:
45
virtual int getErrno() const;
46
+ virtual int getNetErrno() const;
48
virtual UsageEnvironment& operator<<(char const* str);
49
virtual UsageEnvironment& operator<<(int i);
50
diff -ur live/groupsock/GroupsockHelper.cpp live-fix/groupsock/GroupsockHelper.cpp
51
--- live/groupsock/GroupsockHelper.cpp 2009-04-07 04:18:59.000000000 +0200
52
+++ live-fix/groupsock/GroupsockHelper.cpp 2009-04-16 00:30:33.000000000 +0200
54
if (timeout != NULL && result == 0) {
55
break; // this is OK - timeout occurred
56
} else if (result <= 0) {
57
+ if (env.getNetErrno() == EINTR ||
58
#if defined(__WIN32__) || defined(_WIN32)
59
+ env.getNetErrno() == EWOULDBLOCK
61
- if (errno == EINTR || errno == EAGAIN) continue;
62
+ env.getNetErrno() == EAGAIN
65
socketErr(env, "select() error: ");
71
//##### HACK to work around bugs in Linux and Windows:
72
- int err = env.getErrno();
73
+ int err = env.getNetErrno();
74
if (err == 111 /*ECONNREFUSED (Linux)*/
75
#if defined(__WIN32__) || defined(_WIN32)
76
// What a piece of crap Windows is. Sometimes
78
if (setsockopt(socket, IPPROTO_IP, IP_ADD_MEMBERSHIP,
79
(const char*)&imr, sizeof (struct ip_mreq)) < 0) {
80
#if defined(__WIN32__) || defined(_WIN32)
81
- if (env.getErrno() != 0) {
82
+ if (env.getNetErrno() != 0) {
83
// That piece-of-shit toy operating system (Windows) sometimes lies
84
// about setsockopt() failing!
86
diff -ur live/groupsock/include/NetCommon.h live-fix/groupsock/include/NetCommon.h
87
--- live/groupsock/include/NetCommon.h 2009-04-07 04:18:59.000000000 +0200
88
+++ live-fix/groupsock/include/NetCommon.h 2009-04-16 00:30:33.000000000 +0200
91
#define closeSocket closesocket
92
#define EWOULDBLOCK WSAEWOULDBLOCK
93
+#define EINPROGRESS WSAEWOULDBLOCK
94
+#define EINTR WSAEINTR
96
#if defined(_WIN32_WCE)
97
#define NO_STRSTREAM 1
98
diff -ur live/liveMedia/HTTPSink.cpp live-fix/liveMedia/HTTPSink.cpp
99
--- live/liveMedia/HTTPSink.cpp 2009-04-07 04:19:00.000000000 +0200
100
+++ live-fix/liveMedia/HTTPSink.cpp 2009-04-16 00:30:33.000000000 +0200
102
fClientSocket = accept(fSocket, (struct sockaddr*)&clientAddr,
104
if (fClientSocket < 0) {
105
- int err = envir().getErrno();
106
+ int err = envir().getNetErrno();
107
if (err != EWOULDBLOCK) {
108
envir().setResultErrMsg("accept() failed: ");
112
= send(fClientSocket, (char*)(&fBuffer[0]), frameSize, 0);
113
if (sendResult < 0) {
114
- int err = envir().getErrno();
115
+ int err = envir().getNetErrno();
116
if (err != EWOULDBLOCK) {
117
// The client appears to have gone; close him down,
118
// and consider ourselves done:
119
diff -ur live/liveMedia/RTSPClient.cpp live-fix/liveMedia/RTSPClient.cpp
120
--- live/liveMedia/RTSPClient.cpp 2009-04-16 00:31:40.000000000 +0200
121
+++ live-fix/liveMedia/RTSPClient.cpp 2009-04-16 00:30:33.000000000 +0200
122
@@ -1834,11 +1834,7 @@
123
makeSocketNonBlocking(fInputSocketNum);
125
if (connect(fInputSocketNum, (struct sockaddr*) &remoteName, sizeof remoteName) != 0) {
126
-#if defined(__WIN32__) || defined(_WIN32)
127
- if (errno != WSAEINPROGRESS && errno != WSAEWOULDBLOCK) {
129
- if (errno != EINPROGRESS) {
131
+ if (envir().getNetErrno() != EINPROGRESS && envir().getNetErrno() != EWOULDBLOCK) {
132
envir().setResultErrMsg("connect() failed: ");
135
diff -ur live/liveMedia/RTSPOverHTTPServer.cpp live-fix/liveMedia/RTSPOverHTTPServer.cpp
136
--- live/liveMedia/RTSPOverHTTPServer.cpp 2009-04-07 04:19:00.000000000 +0200
137
+++ live-fix/liveMedia/RTSPOverHTTPServer.cpp 2009-04-16 00:30:33.000000000 +0200
139
int clientSocket = accept(fServerSocket, (struct sockaddr*)&clientAddr,
141
if (clientSocket < 0) {
142
- int err = envir().getErrno();
143
+ int err = envir().getNetErrno();
144
if (err != EWOULDBLOCK) {
145
envir().setResultErrMsg("accept() failed: ");
147
diff -ur live/liveMedia/RTSPServer.cpp live-fix/liveMedia/RTSPServer.cpp
148
--- live/liveMedia/RTSPServer.cpp 2009-04-07 04:19:00.000000000 +0200
149
+++ live-fix/liveMedia/RTSPServer.cpp 2009-04-16 00:30:33.000000000 +0200
151
int clientSocket = accept(fServerSocket, (struct sockaddr*)&clientAddr,
153
if (clientSocket < 0) {
154
- int err = envir().getErrno();
155
+ int err = envir().getNetErrno();
156
if (err != EWOULDBLOCK) {
157
envir().setResultErrMsg("accept() failed: ");
159
diff -ur live/UsageEnvironment/include/UsageEnvironment.hh live-fix/UsageEnvironment/include/UsageEnvironment.hh
160
--- live/UsageEnvironment/include/UsageEnvironment.hh 2009-04-07 04:18:59.000000000 +0200
161
+++ live-fix/UsageEnvironment/include/UsageEnvironment.hh 2009-04-16 00:30:33.000000000 +0200
165
virtual int getErrno() const = 0;
166
+ virtual int getNetErrno() const = 0;
169
virtual UsageEnvironment& operator<<(char const* str) = 0;