Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
libvncserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rasky
libvncserver
Commits
0d40904d
Commit
0d40904d
authored
Feb 28, 2006
by
dscho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rfbCheckFds now returns the number of processed events
parent
f52cfa65
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
sockets.c
libvncserver/sockets.c
+13
-10
No files found.
libvncserver/sockets.c
View file @
0d40904d
...
@@ -226,6 +226,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
...
@@ -226,6 +226,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
int
sock
;
int
sock
;
rfbClientIteratorPtr
i
;
rfbClientIteratorPtr
i
;
rfbClientPtr
cl
;
rfbClientPtr
cl
;
int
result
=
0
;
if
(
!
rfbScreen
->
inetdInitDone
&&
rfbScreen
->
inetdSock
!=
-
1
)
{
if
(
!
rfbScreen
->
inetdInitDone
&&
rfbScreen
->
inetdSock
!=
-
1
)
{
rfbNewClientConnection
(
rfbScreen
,
rfbScreen
->
inetdSock
);
rfbNewClientConnection
(
rfbScreen
,
rfbScreen
->
inetdSock
);
...
@@ -238,7 +239,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
...
@@ -238,7 +239,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
tv
.
tv_usec
=
usec
;
tv
.
tv_usec
=
usec
;
nfds
=
select
(
rfbScreen
->
maxFd
+
1
,
&
fds
,
NULL
,
NULL
/* &fds */
,
&
tv
);
nfds
=
select
(
rfbScreen
->
maxFd
+
1
,
&
fds
,
NULL
,
NULL
/* &fds */
,
&
tv
);
if
(
nfds
==
0
)
{
if
(
nfds
==
0
)
{
return
0
;
return
result
;
}
}
if
(
nfds
<
0
)
{
if
(
nfds
<
0
)
{
#ifdef WIN32
#ifdef WIN32
...
@@ -246,22 +247,24 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
...
@@ -246,22 +247,24 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
#endif
#endif
if
(
errno
!=
EINTR
)
if
(
errno
!=
EINTR
)
rfbLogPerror
(
"rfbCheckFds: select"
);
rfbLogPerror
(
"rfbCheckFds: select"
);
return
0
;
return
-
1
;
}
}
result
+=
nfds
;
if
(
rfbScreen
->
listenSock
!=
-
1
&&
FD_ISSET
(
rfbScreen
->
listenSock
,
&
fds
))
{
if
(
rfbScreen
->
listenSock
!=
-
1
&&
FD_ISSET
(
rfbScreen
->
listenSock
,
&
fds
))
{
if
((
sock
=
accept
(
rfbScreen
->
listenSock
,
if
((
sock
=
accept
(
rfbScreen
->
listenSock
,
(
struct
sockaddr
*
)
&
addr
,
&
addrlen
))
<
0
)
{
(
struct
sockaddr
*
)
&
addr
,
&
addrlen
))
<
0
)
{
rfbLogPerror
(
"rfbCheckFds: accept"
);
rfbLogPerror
(
"rfbCheckFds: accept"
);
return
0
;
return
-
1
;
}
}
#ifndef WIN32
#ifndef WIN32
if
(
fcntl
(
sock
,
F_SETFL
,
O_NONBLOCK
)
<
0
)
{
if
(
fcntl
(
sock
,
F_SETFL
,
O_NONBLOCK
)
<
0
)
{
rfbLogPerror
(
"rfbCheckFds: fcntl"
);
rfbLogPerror
(
"rfbCheckFds: fcntl"
);
closesocket
(
sock
);
closesocket
(
sock
);
return
0
;
return
-
1
;
}
}
#endif
#endif
...
@@ -269,7 +272,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
...
@@ -269,7 +272,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
(
char
*
)
&
one
,
sizeof
(
one
))
<
0
)
{
(
char
*
)
&
one
,
sizeof
(
one
))
<
0
)
{
rfbLogPerror
(
"rfbCheckFds: setsockopt"
);
rfbLogPerror
(
"rfbCheckFds: setsockopt"
);
closesocket
(
sock
);
closesocket
(
sock
);
return
0
;
return
-
1
;
}
}
#ifdef USE_LIBWRAP
#ifdef USE_LIBWRAP
...
@@ -278,7 +281,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
...
@@ -278,7 +281,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
rfbLog
(
"Rejected connection from client %s
\n
"
,
rfbLog
(
"Rejected connection from client %s
\n
"
,
inet_ntoa
(
addr
.
sin_addr
));
inet_ntoa
(
addr
.
sin_addr
));
closesocket
(
sock
);
closesocket
(
sock
);
return
0
;
return
-
1
;
}
}
#endif
#endif
...
@@ -288,7 +291,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
...
@@ -288,7 +291,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
FD_CLR
(
rfbScreen
->
listenSock
,
&
fds
);
FD_CLR
(
rfbScreen
->
listenSock
,
&
fds
);
if
(
--
nfds
==
0
)
if
(
--
nfds
==
0
)
return
0
;
return
result
;
}
}
if
((
rfbScreen
->
udpSock
!=
-
1
)
&&
FD_ISSET
(
rfbScreen
->
udpSock
,
&
fds
))
{
if
((
rfbScreen
->
udpSock
!=
-
1
)
&&
FD_ISSET
(
rfbScreen
->
udpSock
,
&
fds
))
{
...
@@ -313,7 +316,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
...
@@ -313,7 +316,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
(
struct
sockaddr
*
)
&
addr
,
addrlen
)
<
0
)
{
(
struct
sockaddr
*
)
&
addr
,
addrlen
)
<
0
)
{
rfbLogPerror
(
"rfbCheckFds: UDP: connect"
);
rfbLogPerror
(
"rfbCheckFds: UDP: connect"
);
rfbDisconnectUDPSock
(
rfbScreen
);
rfbDisconnectUDPSock
(
rfbScreen
);
return
0
;
return
-
1
;
}
}
rfbNewUDPConnection
(
rfbScreen
,
rfbScreen
->
udpSock
);
rfbNewUDPConnection
(
rfbScreen
,
rfbScreen
->
udpSock
);
...
@@ -324,7 +327,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
...
@@ -324,7 +327,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
FD_CLR
(
rfbScreen
->
udpSock
,
&
fds
);
FD_CLR
(
rfbScreen
->
udpSock
,
&
fds
);
if
(
--
nfds
==
0
)
if
(
--
nfds
==
0
)
return
0
;
return
result
;
}
}
i
=
rfbGetClientIterator
(
rfbScreen
);
i
=
rfbGetClientIterator
(
rfbScreen
);
...
@@ -337,7 +340,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
...
@@ -337,7 +340,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
}
}
rfbReleaseClientIterator
(
i
);
rfbReleaseClientIterator
(
i
);
}
while
(
rfbScreen
->
handleEventsEagerly
);
}
while
(
rfbScreen
->
handleEventsEagerly
);
return
1
;
return
result
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment