ANL/LANL integration
This commit is contained in:
@@ -1,7 +1,3 @@
|
||||
|
||||
/* cast_server.c */
|
||||
/* share/src/rsrv $Id$ */
|
||||
|
||||
/* The IOC connection request server */
|
||||
/*
|
||||
*******************************************************************************
|
||||
@@ -12,6 +8,17 @@
|
||||
** cast_server.c - GTA request server main loop
|
||||
** Sun UNIX 4.2 Release 3.4
|
||||
** First Release- Jeff Hill May 88
|
||||
**
|
||||
**
|
||||
**
|
||||
** FIXES NEEDED:
|
||||
**
|
||||
** Dont send channel found message unless there is memory, a task slot,
|
||||
** and a TCP socket available. Send a diagnostic instead.
|
||||
** Or ... make the timeout shorter? This is only a problem if
|
||||
** they persist in trying to make a connection after getting no
|
||||
** response.
|
||||
**
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
@@ -40,11 +47,12 @@ cast_server()
|
||||
int recv_addr_size = sizeof(recv_addr);
|
||||
unsigned nchars;
|
||||
static struct message_buffer udp_msg;
|
||||
# define TIMEOUT 60*5 /* sec */
|
||||
# define TIMEOUT 60 /* sec */
|
||||
unsigned long timeout = TIMEOUT * sysClkRateGet();
|
||||
|
||||
struct client *existing_client();
|
||||
struct client *create_udp_client();
|
||||
void rsrv_online_notify_task();
|
||||
|
||||
if( IOC_cast_sock!=0 && IOC_cast_sock!=ERROR )
|
||||
if( (status = close(IOC_cast_sock)) == ERROR )
|
||||
@@ -67,7 +75,8 @@ cast_server()
|
||||
bfill(&sin, sizeof(sin), 0);
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_addr.s_addr = INADDR_ANY;
|
||||
sin.sin_port = SERVER_NUM;
|
||||
sin.sin_port = CA_SERVER_PORT;
|
||||
|
||||
|
||||
/* get server's Internet address */
|
||||
if (bind (IOC_cast_sock, &sin, sizeof (sin)) == ERROR){
|
||||
@@ -80,6 +89,19 @@ cast_server()
|
||||
|
||||
bfill(&udp_msg, sizeof(udp_msg), NULL);
|
||||
|
||||
/* tell clients we are on line again */
|
||||
status = taskSpawn(
|
||||
CA_ONLINE_NAME,
|
||||
CA_ONLINE_PRI,
|
||||
CA_ONLINE_OPT,
|
||||
CA_ONLINE_STACK,
|
||||
rsrv_online_notify_task);
|
||||
if(status<0){
|
||||
logMsg("Cast_server: couldnt start up online notify task\n");
|
||||
printErrno(errnoGet ());
|
||||
}
|
||||
|
||||
|
||||
while(TRUE){
|
||||
|
||||
status = recvfrom( IOC_cast_sock,
|
||||
@@ -89,7 +111,7 @@ cast_server()
|
||||
&recv_addr,
|
||||
&recv_addr_size);
|
||||
if(status<0){
|
||||
logMsg("Cast_server: UDP recieve error\n");
|
||||
logMsg("Cast_server: UDP recv error\n");
|
||||
printErrno(errnoGet ());
|
||||
taskSuspend(0);
|
||||
}
|
||||
@@ -99,6 +121,8 @@ cast_server()
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(MPDEBUG==2){
|
||||
logMsg( "cast_server(): recieved a broadcast of %d bytes\n", status);
|
||||
logMsg( "from addr %x, port %x \n",
|
||||
@@ -194,7 +218,6 @@ unsigned sock;
|
||||
bfill(client, sizeof(*client), NULL);
|
||||
*/
|
||||
lstInit(&client->addrq);
|
||||
lstInit(&client->eventq);
|
||||
client->tid = 0;
|
||||
client->send.stk = 0;
|
||||
client->send.cnt = 0;
|
||||
@@ -237,8 +260,3 @@ unsigned sock;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
|
||||
/* globalsource.c */
|
||||
/* share/src/rsrv $Id$ */
|
||||
|
||||
/*
|
||||
*******************************************************************************
|
||||
** GTA PROJECT
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
|
||||
/* rsrv_init.c */
|
||||
/* share/src/rsrv $Id$ */
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <lstLib.h>
|
||||
#include <taskLib.h>
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
|
||||
/* server.h */
|
||||
/* share/src/rsrv $Id$ */
|
||||
|
||||
#ifndef INCLfast_lockh
|
||||
#include <fast_lock.h>
|
||||
#endif
|
||||
@@ -25,7 +21,6 @@ struct client{
|
||||
int sock;
|
||||
int proto;
|
||||
LIST addrq;
|
||||
LIST eventq;
|
||||
struct message_buffer send;
|
||||
struct message_buffer recv;
|
||||
struct sockaddr_in addr;
|
||||
@@ -35,6 +30,18 @@ struct client{
|
||||
int tid;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
per channel structure (stored in addrq off of a client block)
|
||||
*/
|
||||
struct channel_in_use{
|
||||
NODE node;
|
||||
struct db_addr addr;
|
||||
LIST eventq;
|
||||
void *chid; /* the chid from the client saved here */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Event block extension for channel access
|
||||
some things duplicated for speed
|
||||
@@ -42,9 +49,11 @@ some things duplicated for speed
|
||||
struct event_ext{
|
||||
NODE node;
|
||||
struct extmsg msg;
|
||||
struct extmsg *mp; /* for speed */
|
||||
struct extmsg *mp; /* for speed (IOC_READ) */
|
||||
struct client *client;
|
||||
char modified; /* modified while event flow control applied */
|
||||
char modified; /* mod & ev flw ctrl enbl */
|
||||
char send_lock; /* lock send buffer */
|
||||
unsigned size; /* for speed */
|
||||
};
|
||||
|
||||
|
||||
@@ -68,54 +77,52 @@ GLBLTYPE LIST rsrv_free_eventq;
|
||||
GLBLTYPE FAST_LOCK rsrv_free_addrq_lck;
|
||||
GLBLTYPE FAST_LOCK rsrv_free_eventq_lck;
|
||||
|
||||
#define LOCK_SEND(CLIENT) \
|
||||
#define LOCK_SEND(CLIENT)\
|
||||
FASTLOCK(&(CLIENT)->send.lock);
|
||||
|
||||
#define UNLOCK_SEND(CLIENT) \
|
||||
#define UNLOCK_SEND(CLIENT)\
|
||||
FASTUNLOCK(&(CLIENT)->send.lock);
|
||||
|
||||
#define EXTMSGPTR(CLIENT) \
|
||||
#define EXTMSGPTR(CLIENT)\
|
||||
((struct extmsg *) &(CLIENT)->send.buf[(CLIENT)->send.stk])
|
||||
|
||||
#define ALLOC_MSG(CLIENT, EXTSIZE) \
|
||||
(struct extmsg *) \
|
||||
#define ALLOC_MSG(CLIENT, EXTSIZE)\
|
||||
(struct extmsg *)\
|
||||
((CLIENT)->send.stk + (EXTSIZE) + sizeof(struct extmsg) > \
|
||||
(CLIENT)->send.maxstk ? send_msg_nolock(CLIENT): NULL, \
|
||||
(CLIENT)->send.stk + (EXTSIZE) + sizeof(struct extmsg) > \
|
||||
(CLIENT)->send.maxstk ? send_msg_nolock(CLIENT): NULL,\
|
||||
(CLIENT)->send.stk + (EXTSIZE) + sizeof(struct extmsg) >\
|
||||
(CLIENT)->send.maxstk ? NULL : EXTMSGPTR(CLIENT))
|
||||
|
||||
#define END_MSG(CLIENT) \
|
||||
#define END_MSG(CLIENT)\
|
||||
(CLIENT)->send.stk += sizeof(struct extmsg) + EXTMSGPTR(CLIENT)->m_postsize
|
||||
|
||||
/* send with lock */
|
||||
#define send_msg(CLIENT) \
|
||||
#define send_msg(CLIENT)\
|
||||
{LOCK_SEND(CLIENT); send_msg_nolock(CLIENT); UNLOCK_SEND(CLIENT)};
|
||||
|
||||
/* send with empty test */
|
||||
#define send_msg_nolock(CLIENT) \
|
||||
#define send_msg_nolock(CLIENT)\
|
||||
!(CLIENT)->send.stk ? FALSE: send_msg_actual(CLIENT)
|
||||
|
||||
/* vanilla send */
|
||||
#define send_msg_actual(CLIENT) \
|
||||
( \
|
||||
(CLIENT)->send.cnt = (CLIENT)->send.stk + sizeof((CLIENT)->send.cnt), \
|
||||
(CLIENT)->send.stk = 0, \
|
||||
MPDEBUG==2?logMsg("Sent a message of %d bytes\n",(CLIENT)->send.cnt):NULL, \
|
||||
#define send_msg_actual(CLIENT)\
|
||||
(\
|
||||
(CLIENT)->send.cnt = (CLIENT)->send.stk + sizeof((CLIENT)->send.cnt),\
|
||||
(CLIENT)->send.stk = 0,\
|
||||
MPDEBUG==2?logMsg("Sent a message of %d bytes\n",(CLIENT)->send.cnt):NULL,\
|
||||
sendto ( (CLIENT)->sock, \
|
||||
&(CLIENT)->send.cnt, \
|
||||
(CLIENT)->send.cnt, \
|
||||
0, \
|
||||
&(CLIENT)->addr, \
|
||||
sizeof((CLIENT)->addr))==ERROR?LOG_SEND_ERROR:TRUE \
|
||||
0,\
|
||||
&(CLIENT)->addr,\
|
||||
sizeof((CLIENT)->addr))==ERROR?LOG_SEND_ERROR,FALSE:TRUE\
|
||||
)
|
||||
|
||||
#define LOG_SEND_ERROR \
|
||||
(logMsg("Send_msg() unable to send, connection broken? %\n"), \
|
||||
printErrno(errnoGet()), \
|
||||
FALSE)
|
||||
(logMsg("Send_msg() unable to send, connection broken? %\n"))
|
||||
|
||||
#define LOCK_CLIENTQ \
|
||||
FASTLOCK(&clientQlock)
|
||||
FASTLOCK(&clientQlock)
|
||||
|
||||
#define UNLOCK_CLIENTQ \
|
||||
FASTUNLOCK(&clientQlock)
|
||||
FASTUNLOCK(&clientQlock)
|
||||
|
||||
Reference in New Issue
Block a user