- FD_ZERO(&DirSet);
- maxDirSet=0;
- for(i=0;i<255;i++)
- if (DirConn[i]!=-1)
- {
- FD_SET(DirConn[i],&DirSet);
- if (maxDirSet<DirConn[i]) maxDirSet=DirConn[i];
- }
-
- if (select(maxDirSet+1,&DirSet,0,0,(struct timeval *)&tout)>0)
- {
- for(i=0;i<255;i++)
- {
- if ( (DirConn[i]!=-1) && (FD_ISSET(DirConn[i],&DirSet)) )
- {
- r=read(DirConn[i],&mx,sizeof(mx));
- if (r>0)
- {
- memcpy(globmsgqueue+msgtail,&mx,sizeof(message));
- msgtail = (msgtail+1) % MAXMSGQUEUE;
- msgready++;
- }
- }
- }
- }
- -----------------------------------------*/
-
-
- FD_ZERO(&rset);
- FD_SET(net_sock,&rset);
- FD_SET(internal_sock,&rset);
- if (net_sock>internal_sock) max = net_sock; else max = internal_sock;
- /* 2010 */
- for(i=0;i<255;i++) {
- if (DirConn[i]!=-1)
- {
- FD_SET(DirConn[i],&rset);
- if (max<DirConn[i]) max=DirConn[i];
- }
- } /* for */
-
- if (select(max+1,&rset,0,0,(struct timeval *)&tout)>0)
- {
-
- /* 2010 */
- for(i=0;i<255;i++)
- {
- if ( (DirConn[i]!=-1) && (FD_ISSET(DirConn[i],&rset)) )
- {
- /*printf("DEBUG: Interp has message on direct connection: type %d par %d\n",mx.control.type,mx.control.par); */
- r=read(DirConn[i],&mx,sizeof(mx));
- if (r>0 && r==sizeof(mx))
- {
- memcpy(globmsgqueue+msgtail,&mx,sizeof(message));
- msgtail = (msgtail+1) % MAXMSGQUEUE;
- msgready++;
- }
- }
- }
-
-
-
-
- if (FD_ISSET(net_sock,&rset))
- {
- r = read(net_sock, &m, sizeof(MESSAGE));
- if (r>0)
- {
- switch(m.msg_type)
- {
- case MSG_NET:
- switch(m.param.pword[0])
- {
- case NET_PROPAGATE:
- /*printf("DEBUG: cint net_sock MSG_NET NET_PROPAGATE cmd %d\n",m.param.pword[6]);*/
- memcpy(globmsgqueue+msgtail,&m.int_msg,sizeof(message));
- msgtail = (msgtail+1) % MAXMSGQUEUE;
- msgready++;
- break;
- }; break;
- } /*switch */
- }
- } /* FD_ISSET */
-
- if (FD_ISSET(internal_sock,&rset))
- {
- r = read(internal_sock,&m,sizeof(MESSAGE));
-
- if (r>0)
- {
- switch(m.msg_type)
- {
- case MSG_INT:
- switch(m.param.pword[0])
- {
- case INT_CLOSE_INSTANCE: endrun(0);
- case INT_KILL: endrun(1);
- default:break;
- } /* switch int */
- case MSG_NET:
- if (m.param.pword[0] == NET_PROPAGATE)
- {
- /*printf("DEBUG: cint internal_sock MSG_NET NET_PROPAGATE cmd %d\n",m.param.pword[6]);*/
- memcpy(globmsgqueue+msgtail,&m.int_msg,sizeof(message));
- msgtail = (msgtail+1) % MAXMSGQUEUE;
- msgready++;
- };break;
-
-
-
- }/*switch type */
- }
- } /* FD_ISSET */
- } /* select */
-
+ FD_ZERO(&DirSet);
+ maxDirSet = 0;
+ for(i = 0; i < 255; i++)
+ if (DirConn[i]!=-1) {
+ FD_SET(DirConn[i], &DirSet);
+ if (maxDirSet<DirConn[i])
+ maxDirSet=DirConn[i];
+ }
+
+ if (select(maxDirSet + 1, &DirSet, 0, 0, (struct timeval *)&tout) > 0) {
+ for(i = 0; i < 255; i++) {
+ if ((DirConn[i] != -1) &&
+ (FD_ISSET(DirConn[i], &DirSet))) {
+ r = read(DirConn[i], &mx, sizeof(mx));
+ if (r > 0) {
+ memcpy(globmsgqueue + msgtail,&mx,
+ sizeof(message));
+ msgtail = (msgtail + 1) % MAXMSGQUEUE;
+ msgready++;
+ }
+ }
+ }
+ }
+-----------------------------------------*/
+
+ FD_ZERO(&rset);
+ FD_SET(net_sock, &rset);
+ FD_SET(internal_sock, &rset);
+ if (net_sock > internal_sock)
+ max = net_sock;
+ else
+ max = internal_sock;
+ /* 2010 */
+ for(i = 0; i < 255; i++) {
+ if (DirConn[i] != -1) {
+ FD_SET(DirConn[i], &rset);
+ if (max < DirConn[i])
+ max = DirConn[i];
+ }
+ }
+
+ if (select(max + 1, &rset, 0, 0, (struct timeval *)&tout) > 0) {
+ /* 2010 */
+ for(i = 0; i < 255; i++) {
+ if ((DirConn[i] != -1) && (FD_ISSET(DirConn[i], &rset))) {
+ /*
+ printf("DEBUG: Interp has message on "
+ "direct connection: type %d par %d\n",
+ mx.control.type,mx.control.par);
+ */
+ r = read(DirConn[i], &mx, sizeof(mx));
+ if (r > 0 && r == sizeof(mx)) {
+ memcpy(globmsgqueue + msgtail, &mx,
+ sizeof(message));
+ msgtail = (msgtail+1) % MAXMSGQUEUE;
+ msgready++;
+ }
+ }
+ }
+
+ if (FD_ISSET(net_sock,&rset)) {
+ r = read(net_sock, &m, sizeof(MESSAGE));
+
+ if (r>0) {
+ switch(m.msg_type) {
+ case MSG_NET:
+ switch(m.param.pword[0]) {
+ case NET_PROPAGATE:
+ /*
+ printf("DEBUG: cint net_sock MSG_NET "
+ "NET_PROPAGATE cmd %d\n",
+ m.param.pword[6]);*/
+ memcpy(globmsgqueue + msgtail,
+ &m.int_msg,
+ sizeof(message));
+ msgtail = (msgtail + 1) %
+ MAXMSGQUEUE;
+ msgready++;
+ break;
+ };
+ break;
+ }
+ }
+ }
+
+ if (FD_ISSET(internal_sock, &rset)) {
+ r = read(internal_sock, &m, sizeof(MESSAGE));
+
+ if (r > 0) {
+ switch(m.msg_type) {
+ case MSG_INT:
+ switch(m.param.pword[0]) {
+ case INT_CLOSE_INSTANCE:
+ endrun(0);
+ case INT_KILL:
+ endrun(1);
+ default:
+ break;
+ }
+ case MSG_NET:
+ if (m.param.pword[0] == NET_PROPAGATE) {
+ /*
+ printf("DEBUG: cint internal_sock MSG_NET NET_PROPAGATE cmd %d\n",m.param.pword[6]);*/
+ memcpy(globmsgqueue + msgtail,
+ &m.int_msg,
+ sizeof(message));
+ msgtail = (msgtail+1) %
+ MAXMSGQUEUE;
+ msgready++;
+ };
+ break;
+ }
+ }
+ }
+ }