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
34f714bc
Commit
34f714bc
authored
May 07, 2005
by
dscho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
socketInitDone -> socketState
parent
1bb36df3
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
96 additions
and
20 deletions
+96
-20
ChangeLog
ChangeLog
+6
-0
nacro.c
VisualNaCro/nacro.c
+5
-1
nacro.h
VisualNaCro/nacro.h
+3
-1
example.c
examples/example.c
+7
-2
fontsel.c
examples/fontsel.c
+3
-1
httpd.c
libvncserver/httpd.c
+7
-0
main.c
libvncserver/main.c
+21
-3
rfbserver.c
libvncserver/rfbserver.c
+1
-4
sockets.c
libvncserver/sockets.c
+27
-2
rfb.h
rfb/rfb.h
+11
-1
cursortest.c
test/cursortest.c
+0
-1
LinuxVNC.c
vncterm/LinuxVNC.c
+1
-1
VNConsole.c
vncterm/VNConsole.c
+3
-2
x11vnc.c
x11vnc/x11vnc.c
+1
-1
No files found.
ChangeLog
View file @
34f714bc
2005-05-07 Johannes E. Schindelin <Johannes.Schindelin@gmx.de>
* libvncserver/rfbserver.c: fix memory leak pointed out by Tim Jansen
* libvncserver/{httpd,main,rfbserver,sockets}.c, rfb/rfb.h:
replace "rfbBool socketInitDone" by "enum rfbSocketState
socketState"
2005-05-03 Karl Runge <runge@karlrunge.com>
* libvncserver/main.c: fix leak in rfbDoCopyRect/rfbScheduleCopyRect
* configure.ac: guard against empty HAVE_X
...
...
VisualNaCro/nacro.c
View file @
34f714bc
...
...
@@ -327,7 +327,11 @@ result_t private_process(resource_t resource,timeout_t timeout_in_seconds,result
rfbBool
loop
;
do
{
loop
=
rfbProcessEvents
(
res
->
server
,
res
->
server
->
deferUpdateTime
);
}
while
(
loop
&&
(
res
->
result
&
return_mask
)
==
0
);
}
while
(
loop
&&
(
res
->
result
&
return_mask
)
==
0
&&
rfbIsActive
(
res
->
server
));
if
(
!
rfbIsActive
(
res
->
server
))
return
RESULT_SHUTDOWN
;
if
((
res
->
result
&
return_mask
)
!=
0
)
return
res
->
result
;
...
...
VisualNaCro/nacro.h
View file @
34f714bc
...
...
@@ -29,11 +29,12 @@ typedef double timeout_t;
/* the return values of process() and friends */
typedef
int
result_t
;
/*
*
%constant int RESULT_TIMEOUT=1;
%constant int RESULT_TIMEOUT=1;
%constant int RESULT_KEY=2;
%constant int RESULT_MOUSE=4;
%constant int RESULT_SCREEN=8;
%constant int RESULT_FOUNDIMAGE=16;
%constant int RESULT_SHUTDOWN=32;
*/
%
}
...
...
@@ -52,6 +53,7 @@ typedef int result_t;
#define RESULT_MOUSE 4
#define RESULT_SCREEN 8
#define RESULT_FOUNDIMAGE 16
#define RESULT_SHUTDOWN 32
/* init/shutdown */
...
...
examples/example.c
View file @
34f714bc
...
...
@@ -168,6 +168,12 @@ void dokey(rfbBool down,rfbKeySym key,rfbClientPtr cl)
if
(
down
)
{
if
(
key
==
XK_Escape
)
rfbCloseClient
(
cl
);
else
if
(
key
==
XK_F12
)
/* close down server, disconnecting clients */
rfbShutdownServer
(
cl
->
screen
,
TRUE
);
else
if
(
key
==
XK_F11
)
/* close down server, but wait for all clients to disconnect */
rfbShutdownServer
(
cl
->
screen
,
FALSE
);
else
if
(
key
==
XK_Page_Up
)
{
initBuffer
((
unsigned
char
*
)
cl
->
screen
->
frameBuffer
);
rfbMarkRectAsModified
(
cl
->
screen
,
0
,
0
,
maxx
,
maxy
);
...
...
@@ -294,7 +300,7 @@ int main(int argc,char** argv)
#ifdef USE_OWN_LOOP
{
int
i
;
for
(
i
=
0
;;
i
++
)
{
for
(
i
=
0
;
rfbIsActive
(
rfbScreen
)
;
i
++
)
{
fprintf
(
stderr
,
"%d
\r
"
,
i
);
rfbProcessEvents
(
rfbScreen
,
100000
);
}
...
...
@@ -315,7 +321,6 @@ int main(int argc,char** argv)
while
(
1
)
sleep
(
5
);
/* render(); */
#endif
/* BACKGROUND_LOOP */
rfbFreeCursor
(
rfbScreen
->
cursor
);
free
(
rfbScreen
->
frameBuffer
);
rfbScreenCleanup
(
rfbScreen
);
...
...
examples/fontsel.c
View file @
34f714bc
...
...
@@ -58,13 +58,15 @@ int main(int argc,char** argv)
exit
(
1
);
}
for
(
j
=
0
;
j
<
0
;
j
++
)
for
(
j
=
0
;
j
<
0
&&
rfbIsActive
(
s
)
;
j
++
)
rfbProcessEvents
(
s
,
900000
);
i
=
rfbSelectBox
(
s
,
font
,
fontlist
,
10
,
20
,
200
,
300
,
0xffdfdf
,
0x602040
,
2
,
showFont
);
rfbLog
(
"Selection: %d: %s
\n
"
,
i
,(
i
>=
0
)
?
fontlist
[
i
]
:
"cancelled"
);
rfbFreeFont
(
font
);
free
(
s
->
frameBuffer
);
rfbScreenCleanup
(
s
);
return
(
0
);
}
...
...
libvncserver/httpd.c
View file @
34f714bc
...
...
@@ -111,6 +111,13 @@ rfbHttpInitSockets(rfbScreenInfoPtr rfbScreen)
/*AddEnabledDevice(httpListenSock);*/
}
void
rfbHttpShutdownSockets
(
rfbScreenInfoPtr
rfbScreen
)
{
if
(
rfbScreen
->
httpSock
>-
1
)
{
close
(
rfbScreen
->
httpSock
);
FD_CLR
(
rfbScreen
->
httpSock
,
&
rfbScreen
->
allFds
);
rfbScreen
->
httpSock
=-
1
;
}
}
/*
* httpCheckFds is called from ProcessInputEvents to check for input on the
...
...
libvncserver/main.c
View file @
34f714bc
...
...
@@ -543,7 +543,7 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
screen
->
clientHead
=
0
;
screen
->
pointerClient
=
0
;
screen
->
port
=
5900
;
screen
->
socket
InitDone
=
FALSE
;
screen
->
socket
State
=
RFB_SOCKET_INIT
;
screen
->
inetdInitDone
=
FALSE
;
screen
->
inetdSock
=-
1
;
...
...
@@ -729,7 +729,7 @@ void rfbScreenCleanup(rfbScreenInfoPtr screen)
FREE_IF
(
colourMap
.
data
.
bytes
);
FREE_IF
(
underCursorBuffer
);
TINI_MUTEX
(
screen
->
cursorMutex
);
if
(
screen
->
cursor
)
if
(
screen
->
cursor
&&
screen
->
cursor
->
cleanup
)
rfbFreeCursor
(
screen
->
cursor
);
free
(
screen
);
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
...
...
@@ -751,6 +751,20 @@ void rfbInitServer(rfbScreenInfoPtr screen)
#endif
}
void
rfbShutdownServer
(
rfbScreenInfoPtr
screen
,
rfbBool
disconnectClients
)
{
if
(
disconnectClients
)
{
rfbClientPtr
cl
;
rfbClientIteratorPtr
iter
=
rfbGetClientIterator
(
screen
);
while
(
(
cl
=
rfbClientIteratorNext
(
iter
))
)
if
(
cl
->
sock
>
-
1
)
/* we don't care about maxfd here, because the server goes away */
rfbCloseClient
(
cl
);
}
rfbShutdownSockets
(
screen
);
rfbHttpShutdownSockets
(
screen
);
}
#ifndef LIBVNCSERVER_HAVE_GETTIMEOFDAY
#include <fcntl.h>
#include <conio.h>
...
...
@@ -820,6 +834,10 @@ rfbProcessEvents(rfbScreenInfoPtr screen,long usec)
return
result
;
}
rfbBool
rfbIsActive
(
rfbScreenInfoPtr
screenInfo
)
{
return
screenInfo
->
socketState
!=
RFB_SOCKET_SHUTDOWN
||
screenInfo
->
clientHead
!=
NULL
;
}
void
rfbRunEventLoop
(
rfbScreenInfoPtr
screen
,
long
usec
,
rfbBool
runInBackground
)
{
if
(
runInBackground
)
{
...
...
@@ -839,6 +857,6 @@ void rfbRunEventLoop(rfbScreenInfoPtr screen, long usec, rfbBool runInBackground
if
(
usec
<
0
)
usec
=
screen
->
deferUpdateTime
*
1000
;
while
(
1
)
while
(
rfbIsActive
(
screen
)
)
rfbProcessEvents
(
screen
,
usec
);
}
libvncserver/rfbserver.c
View file @
34f714bc
...
...
@@ -354,10 +354,7 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP)
if
(
rfbWriteExact
(
cl
,
pv
,
sz_rfbProtocolVersionMsg
)
<
0
)
{
rfbLogPerror
(
"rfbNewClient: write"
);
rfbCloseClient
(
cl
);
/* TODO: memory leak here (cl is never freed)
* can rfbClientConnectionGone called at this time?
* tim@tjansen.de
*/
rfbClientConnectionGone
(
cl
);
return
NULL
;
}
}
...
...
libvncserver/sockets.c
View file @
34f714bc
...
...
@@ -104,10 +104,10 @@ rfbInitSockets(rfbScreenInfoPtr rfbScreen)
{
in_addr_t
iface
=
rfbScreen
->
listenInterface
;
if
(
rfbScreen
->
socket
InitDone
)
if
(
rfbScreen
->
socket
State
!=
RFB_SOCKET_INIT
)
return
;
rfbScreen
->
socket
InitDone
=
TRUE
;
rfbScreen
->
socket
State
=
RFB_SOCKET_READY
;
if
(
rfbScreen
->
inetdSock
!=
-
1
)
{
const
int
one
=
1
;
...
...
@@ -176,6 +176,31 @@ rfbInitSockets(rfbScreenInfoPtr rfbScreen)
}
}
void
rfbShutdownSockets
(
rfbScreenInfoPtr
rfbScreen
)
{
if
(
rfbScreen
->
socketState
!=
RFB_SOCKET_READY
)
return
;
rfbScreen
->
socketState
=
RFB_SOCKET_SHUTDOWN
;
if
(
rfbScreen
->
inetdSock
>-
1
)
{
close
(
rfbScreen
->
inetdSock
);
FD_CLR
(
rfbScreen
->
inetdSock
,
&
rfbScreen
->
allFds
);
rfbScreen
->
inetdSock
=-
1
;
}
if
(
rfbScreen
->
listenSock
>-
1
)
{
close
(
rfbScreen
->
listenSock
);
FD_CLR
(
rfbScreen
->
listenSock
,
&
rfbScreen
->
allFds
);
rfbScreen
->
listenSock
=-
1
;
}
if
(
rfbScreen
->
udpSock
>-
1
)
{
close
(
rfbScreen
->
udpSock
);
FD_CLR
(
rfbScreen
->
udpSock
,
&
rfbScreen
->
allFds
);
rfbScreen
->
udpSock
=-
1
;
}
}
/*
* rfbCheckFds is called from ProcessInputEvents to check for input on the RFB
...
...
rfb/rfb.h
View file @
34f714bc
...
...
@@ -116,6 +116,12 @@ enum rfbNewClientAction {
RFB_CLIENT_REFUSE
};
enum
rfbSocketState
{
RFB_SOCKET_INIT
,
RFB_SOCKET_READY
,
RFB_SOCKET_SHUTDOWN
};
typedef
void
(
*
rfbKbdAddEventProcPtr
)
(
rfbBool
down
,
rfbKeySym
keySym
,
struct
_rfbClientRec
*
cl
);
typedef
void
(
*
rfbKbdReleaseAllKeysProcPtr
)
(
struct
_rfbClientRec
*
cl
);
typedef
void
(
*
rfbPtrAddEventProcPtr
)
(
int
buttonMask
,
int
x
,
int
y
,
struct
_rfbClientRec
*
cl
);
...
...
@@ -178,7 +184,7 @@ typedef struct _rfbScreenInfo
fd_set
allFds
;
#endif
rfbBool
socketInitDon
e
;
enum
rfbSocketState
socketStat
e
;
SOCKET
inetdSock
;
rfbBool
inetdInitDone
;
...
...
@@ -500,6 +506,7 @@ extern char rfbEndianTest;
extern
int
rfbMaxClientWait
;
extern
void
rfbInitSockets
(
rfbScreenInfoPtr
rfbScreen
);
extern
void
rfbShutdownSockets
(
rfbScreenInfoPtr
rfbScreen
);
extern
void
rfbDisconnectUDPSock
(
rfbScreenInfoPtr
rfbScreen
);
extern
void
rfbCloseClient
(
rfbClientPtr
cl
);
extern
int
rfbReadExact
(
rfbClientPtr
cl
,
char
*
buf
,
int
len
);
...
...
@@ -563,6 +570,7 @@ extern void rfbSetClientColourMaps(rfbScreenInfoPtr rfbScreen, int firstColour,
/* httpd.c */
extern
void
rfbHttpInitSockets
(
rfbScreenInfoPtr
rfbScreen
);
extern
void
rfbHttpShutdownSockets
(
rfbScreenInfoPtr
rfbScreen
);
extern
void
rfbHttpCheckFds
(
rfbScreenInfoPtr
rfbScreen
);
...
...
@@ -741,6 +749,7 @@ extern rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
int
width
,
int
height
,
int
bitsPerSample
,
int
samplesPerPixel
,
int
bytesPerPixel
);
extern
void
rfbInitServer
(
rfbScreenInfoPtr
rfbScreen
);
extern
void
rfbShutdownServer
(
rfbScreenInfoPtr
rfbScreen
,
rfbBool
disconnectClients
);
extern
void
rfbNewFramebuffer
(
rfbScreenInfoPtr
rfbScreen
,
char
*
framebuffer
,
int
width
,
int
height
,
int
bitsPerSample
,
int
samplesPerPixel
,
int
bytesPerPixel
);
...
...
@@ -761,6 +770,7 @@ extern void rfbRefuseOnHoldClient(rfbClientPtr cl);
extern
void
rfbRunEventLoop
(
rfbScreenInfoPtr
screenInfo
,
long
usec
,
rfbBool
runInBackground
);
extern
rfbBool
rfbProcessEvents
(
rfbScreenInfoPtr
screenInfo
,
long
usec
);
extern
rfbBool
rfbIsActive
(
rfbScreenInfoPtr
screenInfo
);
#endif
...
...
test/cursortest.c
View file @
34f714bc
...
...
@@ -343,7 +343,6 @@ int main(int argc,char** argv)
/* 40000 are the microseconds to wait on select(), i.e. 0.04 seconds */
rfbRunEventLoop
(
rfbScreen
,
40000
,
FALSE
);
rfbFreeCursor
(
rfbScreen
->
cursor
);
free
(
rfbScreen
->
frameBuffer
);
rfbScreenCleanup
(
rfbScreen
);
...
...
vncterm/LinuxVNC.c
View file @
34f714bc
...
...
@@ -137,7 +137,7 @@ int main(int argc,char **argv)
sprintf
(
tty_device
,
"/dev/vcsa%d"
,
tty
);
#endif
while
(
1
)
{
while
(
rfbIsActive
(
console
->
screen
)
)
{
if
(
!
console
->
currentlyMarking
)
{
tty_file
=
fopen
(
tty_device
,
"rb"
);
if
(
!
tty_file
)
{
...
...
vncterm/VNConsole.c
View file @
34f714bc
...
...
@@ -328,7 +328,7 @@ char vcGetCh(vncConsolePtr c)
char
vcGetChar
(
vncConsolePtr
c
)
{
while
(
c
->
inputCount
==
0
)
while
(
rfbIsActive
(
c
->
screen
)
&&
c
->
inputCount
==
0
)
vcProcessEvents
(
c
);
return
(
vcGetCh
(
c
));
}
...
...
@@ -352,7 +352,8 @@ char *vcGetString(vncConsolePtr c,char *buffer,int bufferSize)
count
=
c
->
inputSize
;
c
->
inputSize
=
bufferSize
;
c
->
inputBuffer
=
buffer
;
while
(
c
->
inputCount
<
bufferSize
-
1
&&
buffer
[
c
->
inputCount
-
1
]
!=
'\n'
)
while
(
rfbIsActive
(
c
->
screen
)
&&
c
->
inputCount
<
bufferSize
-
1
&&
buffer
[
c
->
inputCount
-
1
]
!=
'\n'
)
vcProcessEvents
(
c
);
buffer
[
c
->
inputCount
]
=
0
;
c
->
inputBuffer
=
bufferBackup
;
...
...
x11vnc/x11vnc.c
View file @
34f714bc
...
...
@@ -9558,7 +9558,7 @@ void reset_rfbport(int old, int new) {
screen->autoPort = FALSE;
}
screen->port = rp;
screen
->
socket
InitDone
=
FALSE
;
screen->socket
State = RFB_SOCKET_INIT
;
if (screen->listenSock > -1) {
close(screen->listenSock);
...
...
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