Mercurial > libavformat.hg
comparison tcp.c @ 1689:3fa40cd9fdae libavformat
BeOS cleanup
Patch by Ramiro Polla % ramiro A lisha P ufsc P br %
Original thread:
date: Jan 20, 2007 8:56 PM
subject: [Ffmpeg-devel] [PATCH] [RFC] change socket read and write functions
author | gpoirier |
---|---|
date | Sun, 21 Jan 2007 20:40:22 +0000 |
parents | 818eafa8fc95 |
children | 1f7a6dc01100 |
comparison
equal
deleted
inserted
replaced
1688:0ab2495a1815 | 1689:3fa40cd9fdae |
---|---|
140 FD_SET(s->fd, &rfds); | 140 FD_SET(s->fd, &rfds); |
141 tv.tv_sec = 0; | 141 tv.tv_sec = 0; |
142 tv.tv_usec = 100 * 1000; | 142 tv.tv_usec = 100 * 1000; |
143 ret = select(fd_max + 1, &rfds, NULL, NULL, &tv); | 143 ret = select(fd_max + 1, &rfds, NULL, NULL, &tv); |
144 if (ret > 0 && FD_ISSET(s->fd, &rfds)) { | 144 if (ret > 0 && FD_ISSET(s->fd, &rfds)) { |
145 #ifdef __BEOS__ | |
146 len = recv(s->fd, buf, size, 0); | 145 len = recv(s->fd, buf, size, 0); |
147 #else | |
148 len = read(s->fd, buf, size); | |
149 #endif | |
150 if (len < 0) { | 146 if (len < 0) { |
151 if (errno != EINTR && errno != EAGAIN) | 147 if (errno != EINTR && errno != EAGAIN) |
152 #ifdef __BEOS__ | 148 #ifdef __BEOS__ |
153 return errno; | 149 return errno; |
154 #else | 150 #else |
177 FD_SET(s->fd, &wfds); | 173 FD_SET(s->fd, &wfds); |
178 tv.tv_sec = 0; | 174 tv.tv_sec = 0; |
179 tv.tv_usec = 100 * 1000; | 175 tv.tv_usec = 100 * 1000; |
180 ret = select(fd_max + 1, NULL, &wfds, NULL, &tv); | 176 ret = select(fd_max + 1, NULL, &wfds, NULL, &tv); |
181 if (ret > 0 && FD_ISSET(s->fd, &wfds)) { | 177 if (ret > 0 && FD_ISSET(s->fd, &wfds)) { |
182 #ifdef __BEOS__ | |
183 len = send(s->fd, buf, size, 0); | 178 len = send(s->fd, buf, size, 0); |
184 #else | |
185 len = write(s->fd, buf, size); | |
186 #endif | |
187 if (len < 0) { | 179 if (len < 0) { |
188 if (errno != EINTR && errno != EAGAIN) { | 180 if (errno != EINTR && errno != EAGAIN) { |
189 #ifdef __BEOS__ | 181 #ifdef __BEOS__ |
190 return errno; | 182 return errno; |
191 #else | 183 #else |