Merge lp:~jeff-apple/openvista-gtm-integration/listener into lp:openvista-gtm-integration

Proposed by jeff.apple
Status: Merged
Merged at revision: 144
Proposed branch: lp:~jeff-apple/openvista-gtm-integration/listener
Merge into: lp:openvista-gtm-integration
Diff against target: 60 lines (+9/-5)
3 files modified
mumps/ZISTCPS.m (+6/-3)
src/libopenvista/gtmserver.c (+2/-1)
src/libopenvista/openvista.xc.in (+1/-1)
To merge this branch: bzr merge lp:~jeff-apple/openvista-gtm-integration/listener
Reviewer Review Type Date Requested Status
Jon Tai Approve
Review via email: mp+42401@code.launchpad.net

Description of the change

Close listener socket in child process

To post a comment you must log in.
Revision history for this message
Jon Tai (jontai) wrote :

Sorry to be nitpicky, but can you revert the whitespace changes in ZISTCPS.m?

Also, it looks like there's some debugging code left over in GTMLNCH^%ZISTCPS.

I haven't tested the changes yet, but I can follow what it's doing and it seems correct to me.

gtmserver.c and openvista.xc.in look good.

I'll give it some testing and file a bug for it before I merge. Good work tracking this one down!

145. By jeff.apple

No logic changes. Just whitespace and comment.

Revision history for this message
jeff.apple (jeff-apple) wrote :

> Sorry to be nitpicky, but can you revert the whitespace changes in ZISTCPS.m?
>
> Also, it looks like there's some debugging code left over in GTMLNCH^%ZISTCPS.
>
> I haven't tested the changes yet, but I can follow what it's doing and it
> seems correct to me.
>
> gtmserver.c and openvista.xc.in look good.
>
> I'll give it some testing and file a bug for it before I merge. Good work
> tracking this one down!

This fixes the whitespace changes and debugging cruft. I'm not sure how to get LP to show a decent on-screen diff, but the "Diff against target" looks right.

Revision history for this message
Jon Tai (jontai) wrote :

Looks good. I'll hopefully get around to testing this tomorrow.

review: Approve
Revision history for this message
Jon Tai (jontai) wrote :

I was able to start the RPC broker, force the PIDs on my system to roll over, and telnet to the broker. netstat -lpn confirmed that the port is only attached to the listener process, not the child.

I was also able to establish a connection to the RPC broker with a real client, shut down the listener, and and start a new one without dropping the established connection.

Everything looks good -- I'll start packaging this now.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'mumps/ZISTCPS.m'
2--- mumps/ZISTCPS.m 2009-06-05 20:09:12 +0000
3+++ mumps/ZISTCPS.m 2010-12-01 20:50:10 +0000
4@@ -1,4 +1,4 @@
5-%ZISTCPS ;ISF/RWF MSC/JDA - DEVICE HANDLER TCP/IP SERVER CALLS ;22APR2009
6+%ZISTCPS ;ISF/RWF MSC/JDA - DEVICE HANDLER TCP/IP SERVER CALLS ;01DEC2010
7 ;;8.0;KERNEL;**78,118,127,225,275,388,MSC**;Jul 10, 1995
8 Q
9 ;
10@@ -69,8 +69,11 @@
11 U NIO S NIO("ZISTCP",0)=$KEY D LOG("Have port.")
12 ;Start Listening
13 W /LISTEN(1) S NIO("ZISTCP",1)=$KEY D LOG("Start Listening. "_NIO("ZISTCP",1))
14- N ZC,ZR,IDX,DESC
15+ N ZC,ZR,IDX,DESC,LDESC
16 S ZC="ZSHOW ""D"":ZR"
17+ X ZC
18+ ; Find the listener file descriptor. The child must close it.
19+ S LDESC="" F IDX=1:1:$O(ZR("D",""),-1) S:(ZR("D",IDX)["listener")&(ZR("D",IDX)["PORT="_SOCK) LDESC=$P($P(ZR("D",IDX),"DESC=",2)," ",1) Q:LDESC'=""
20 ;Wait for connection
21 LG2 S %A=0,EXIT=0 F D Q:%A!EXIT
22 . U NIO:(SOCKET="listener")
23@@ -91,7 +94,7 @@
24 S DESC="" F IDX=1:1:$O(ZR("D",""),-1) S:ZR("D",IDX)[NIO("SOCK") DESC=$P($P(ZR("D",IDX),"DESC=",2)," ",1) Q:DESC'=""
25 I DESC="" D LOG("Can not find file descriptor!") G LG2
26 ;spawn child process
27- S SPAWNID=$&openvista.gtmserver(DESC,"GTMLNCH^%ZISTCPS")
28+ S SPAWNID=$&openvista.gtmserver(DESC,LDESC,"GTMLNCH^%ZISTCPS")
29 L +^TMP("ZISTCPS",SPAWNID)
30 S ^TMP("ZISTCPS",SPAWNID)=RTN
31 L -^TMP("ZISTCPS",SPAWNID)
32
33=== modified file 'src/libopenvista/gtmserver.c'
34--- src/libopenvista/gtmserver.c 2009-04-23 04:45:12 +0000
35+++ src/libopenvista/gtmserver.c 2010-12-01 20:50:10 +0000
36@@ -26,7 +26,7 @@
37 #define RETRY_EINTR(x) for(;;) if ((x)!=EINTR) break
38 #define SEND_PID (write(fds[1], &grandchild_id, sizeof(int)))
39
40-xc_long_t gtmserver(int count, int connfd, const char *cmd) {
41+xc_long_t gtmserver(int count, int connfd, int listen_fd, const char *cmd) {
42 int fds[2];
43 int child_id;
44 int grandchild_id;
45@@ -49,6 +49,7 @@
46 }
47 if (child_id==0) {
48 /* In child */
49+ RETRY_EINTR(close(listen_fd));
50 RETRY_EINTR(result=close(fds[0]) );
51 if (result != 0) {
52 perror("child close()");
53
54=== modified file 'src/libopenvista/openvista.xc.in'
55--- src/libopenvista/openvista.xc.in 2009-07-08 04:08:14 +0000
56+++ src/libopenvista/openvista.xc.in 2010-12-01 20:50:10 +0000
57@@ -1,2 +1,2 @@
58 @GTM_DIST@/libopenvista.so
59-gtmserver: xc_long_t gtmserver(I:xc_long_t, I:xc_char_t*)
60+gtmserver: xc_long_t gtmserver(I:xc_long_t, I:xc_long_t, I:xc_char_t*)

Subscribers

People subscribed via source and target branches