src/stored/hello.c
bool read_client_hello(JCR *jcr)
{
   int i;
   int stat;
   int fd_version = 0;
   int sd_version = 0;
   BSOCK *cl = jcr->file_bsock;
   char job_name[500];

   /* We connected to Client, so finish work */
   if (!cl) {
      Jmsg0(jcr, M_FATAL, 0, _("Client socket not open. Could not connect to Client.\n"));
      Dmsg0(050, "Client socket not open. Could not connect to Client.\n");
      return false;
   }
   /* Get response to Hello command sent earlier */
   Dmsg0(050, "Read Hello command from Client\n");
   for (i=0; i<60; i++) {
      stat = cl->recv();
      if (stat <= 0) {
         bmicrosleep(1, 0);
      } else {
         break;
      }
   }
   if (stat <= 0) {
      berrno be;
      Jmsg1(jcr, M_FATAL, 0, _("Recv request to Client failed. ERR=%s\n"),
         be.bstrerror());
      Dmsg1(050, _("Recv request to Client failed. ERR=%s\n"), be.bstrerror());
      return false;
   }
   Dmsg1(050, ">filed: %s\n", cl->msg);
   if (sscanf(cl->msg, "Hello Bacula SD: Start Job %127s %d %d", job_name, &fd_version, &sd_version) != 3) {
      Jmsg1(jcr, M_FATAL, 0, _("Bad Hello from Client: %s.\n"), cl->msg);
      Dmsg1(050, _("Bad Hello from Client: %s.\n"), cl->msg);
      return false;
   }
   unbash_spaces(job_name);
   jcr->FDVersion = fd_version;
   jcr->SDVersion = sd_version;
   Dmsg1(050, "FDVersion=%d\n", fd_version);
   /* Turn on compression for newer FDs, except for Community version */
   if (jcr->FDVersion >= 214 && me->comm_compression) {
      cl->set_compress();             /* set compression allowed */
   } else {
      cl->clear_compress();
      Dmsg0(050, "*** No SD compression to FD\n");
   }

   return true;
}
/*
 * If sd_calls_client, we must read the client's response to
 *   the hello we previously sent.
 */
If sd_calls_client, we must read the client's response to
the hello we previously sent.
If sd_calls_client we must read the client ' s response to the hello we previously sent .
bool read_client_hello(JCR *jcr)
{
   int i;
   int stat;
   int fd_version = 0;
   int sd_version = 0;
   BSOCK *cl = jcr->file_bsock;
   char job_name[500];
   if (!cl) {
      Jmsg0(jcr, M_FATAL, 0, _("Client socket not open. Could not connect to Client.\n"));
      Dmsg0(050, "Client socket not open. Could not connect to Client.\n");
      return false;
   }
   Dmsg0(050, "Read Hello command from Client\n");
   for (i=0; i<60; i++) {
      stat = cl->recv();
      if (stat <= 0) {
         bmicrosleep(1, 0);
      } else {
         break;
      }
   }
   if (stat <= 0) {
      berrno be;
      Jmsg1(jcr, M_FATAL, 0, _("Recv request to Client failed. ERR=%s\n"),
         be.bstrerror());
      Dmsg1(050, _("Recv request to Client failed. ERR=%s\n"), be.bstrerror());
      return false;
   }
   Dmsg1(050, ">filed: %s\n", cl->msg);
   if (sscanf(cl->msg, "Hello Bacula SD: Start Job %127s %d %d", job_name, &fd_version, &sd_version) != 3) {
      Jmsg1(jcr, M_FATAL, 0, _("Bad Hello from Client: %s.\n"), cl->msg);
      Dmsg1(050, _("Bad Hello from Client: %s.\n"), cl->msg);
      return false;
   }
   unbash_spaces(job_name);
   jcr->FDVersion = fd_version;
   jcr->SDVersion = sd_version;
   Dmsg1(050, "FDVersion=%d\n", fd_version);
   if (jcr->FDVersion >= 214 && me->comm_compression) {
      cl->set_compress();             
   } else {
      cl->clear_compress();
      Dmsg0(050, "*** No SD compression to FD\n");
   }
   return true;
}
bool read_client_hello ( JCR * jcr ) { int i ; int stat ; int fd_version = 0 ; int sd_version = 0 ; BSOCK * cl = jcr -> file_bsock ; char job_name [ 500 ] ; if ( ! cl ) { Jmsg0 ( jcr , M_FATAL , 0 , _ ( " \n " ) ) ; Dmsg0 ( 050 , " \n " ) ; return false ; } Dmsg0 ( 050 , " \n " ) ; for ( i = 0 ; i < 60 ; i ++ ) { stat = cl -> recv ( ) ; if ( stat <= 0 ) { bmicrosleep ( 1 , 0 ) ; } else { break ; } } if ( stat <= 0 ) { berrno be ; Jmsg1 ( jcr , M_FATAL , 0 , _ ( " \n " ) , be . bstrerror ( ) ) ; Dmsg1 ( 050 , _ ( " \n " ) , be . bstrerror ( ) ) ; return false ; } Dmsg1 ( 050 , " \n " , cl -> msg ) ; if ( sscanf ( cl -> msg , " " , job_name , & fd_version , & sd_version ) != 3 ) { Jmsg1 ( jcr , M_FATAL , 0 , _ ( " \n " ) , cl -> msg ) ; Dmsg1 ( 050 , _ ( " \n " ) , cl -> msg ) ; return false ; } unbash_spaces ( job_name ) ; jcr -> FDVersion = fd_version ; jcr -> SDVersion = sd_version ; Dmsg1 ( 050 , " \n " , fd_version ) ; if ( jcr -> FDVersion >= 214 && me -> comm_compression ) { cl -> set_compress ( ) ; } else { cl -> clear_compress ( ) ; Dmsg0 ( 050 , " \n " ) ; } return true ; }
If sd_calls_client, we must read the client's response to
   the hello we previously sent.
If sd_calls_client we must read the client ' s response to the hello we previously sent .
/* We connected to Client, so finish work */ /* Get response to Hello command sent earlier */ /* Turn on compression for newer FDs, except for Community version */ /* set compression allowed */