IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16903


Ignore:
Timestamp:
Mar 9, 2008, 11:05:49 AM (18 years ago)
Author:
eugene
Message:

better handling for client / server connect / disconnect / shutdown

Location:
trunk/Ohana/src/opihi
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/lib.shell/multicommand.c

    r16472 r16903  
    33static int server = 0;
    44static int bufferPending = FALSE;
     5
     6int getServer () {
     7  return (server);
     8}
    59
    610// XXX this is rather pantasks-specific...
     
    2832  SendCommand (server, strlen(PASSWORD), PASSWORD);
    2933 
     34  return;
     35}
     36
     37// close connection with remote server
     38void multicommand_StopServer () {
     39
     40  if (!server) return;
     41  close (server);
     42  server = 0;
    3043  return;
    3144}
     
    5871      if (bufferPending) {
    5972        // flush old messages
    60         while (ExpectMessage (server, 0.2, &message));
     73        ExpectMessage (server, 0.2, &message);
    6174        bufferPending = FALSE;
    6275      }
  • trunk/Ohana/src/opihi/pantasks/ListenClients.c

    r15791 r16903  
    11# include "pantasks.h"
    2 # define DEBUG 0
     2# define DEBUG 1
    33
    44static int NCLIENTS;
  • trunk/Ohana/src/opihi/pantasks/Makefile

    r13540 r16903  
    2323$(SRC)/client_shell.$(ARCH).o \
    2424$(SRC)/invalid.$(ARCH).o \
     25$(SRC)/server_shutdown.$(ARCH).o \
     26$(SRC)/server_disconnect.$(ARCH).o \
     27$(SRC)/server_connect.$(ARCH).o \
    2528$(SRC)/init_client.$(ARCH).o
    2629
  • trunk/Ohana/src/opihi/pantasks/init_client.c

    r16453 r16903  
    11# include "pantasks.h"
    22
    3 int invalid         PROTO((int, char **));
     3int invalid           PROTO((int, char **));
     4int server_shutdown   PROTO((int, char **));
     5int server_disconnect PROTO((int, char **));
     6int server_connect    PROTO((int, char **));
    47
    5 /* we list here commands which are not valid for the client,
    6    but represent valid pantasks commands.  these are caught
    7    by the client and sent to the 'invalid' function */
     8/* we also list here commands which are not valid for the client, but represent valid
     9   pantasks commands.  these are caught by the client and sent to the 'invalid'
     10   function */
    811
    912static Command cmds[] = { 
    10   {1, "task",       invalid,  "define a schedulable task"},
    11   {1, "task.exit",  invalid,  "define exit macros for a task"},
    12   {1, "task.exec",  invalid,  "define pre-exec macro for a task"},
     13  {1, "task",       invalid,     "define a schedulable task"},
     14  {1, "task.exit",  invalid,     "define exit macros for a task"},
     15  {1, "task.exec",  invalid,     "define pre-exec macro for a task"},
     16
     17  {1, "shutdown",   server_shutdown,   "send exit signal to server"},
     18  {1, "disconnect", server_disconnect, "close connection to server"},
     19  {1, "connect",    server_connect,    "open connection to server"},
     20
    1321};
    1422
  • trunk/Ohana/src/opihi/pantasks/init_server.c

    r16453 r16903  
    2525int ipptool2book    PROTO((int, char **));
    2626
     27int server_run      PROTO((int, char **));
     28int server_stop     PROTO((int, char **));
     29int server_halt     PROTO((int, char **));
     30
    2731static Command cmds[] = { 
    2832  {1, "active",     task_active,   "set the active state of a task"},
     
    5054  {1, "verbose",    verbose,       "set/toggle verbose mode"},
    5155  {1, "version",    version,       "show version information"},
     56
     57  {1, "run",        server_run,    "run scheduler"},
     58  {1, "stop",       server_stop,   "stop scheduler"},
     59  {1, "halt",       server_halt,   "halt scheduler"},
    5260};
    5361
Note: See TracChangeset for help on using the changeset viewer.