DDVSocket edits

This commit is contained in:
Thulinma 2010-11-08 16:29:06 +01:00
parent 7ef4d086ff
commit 548e6aab95
2 changed files with 5 additions and 1 deletions

View file

@ -48,7 +48,7 @@ int main(int argc, char ** argv){
int status;
while (server_socket > 0){
waitpid((pid_t)-1, &status, WNOHANG);
CONN_fd = DDV_Accept(server_socket, true);
CONN_fd = DDV_Accept(server_socket);
if (CONN_fd > 0){
pid_t myid = fork();
if (myid == 0){

View file

@ -88,7 +88,11 @@ bool DDV_write(void * buffer, int todo, int sock){
bool DDV_ready(int sock){
char tmp;
int preflags = fcntl(sock, F_GETFL, 0);
int postflags = preflags | O_NONBLOCK;
fcntl(sock, F_SETFL, postflags);
int r = recv(sock, &tmp, 1, MSG_PEEK);
fcntl(sock, F_SETFL, preflags);
return (r == 1);
}