]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
meta: Terminate jar. rpms: multi-version m365
authorEric Bollengier <eric@baculasystems.com>
Fri, 18 Mar 2022 12:54:29 +0000 (13:54 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:56:58 +0000 (13:56 +0200)
bacula/src/plugins/fd/pluginlib/metaplugin.cpp
bacula/src/plugins/fd/pluginlib/ptcomm.cpp

index ba89e477401e31d166b544d3ca57e79f84b74b94..4fcf619be0e7f682123216c10edf9a18ca68ac37 100644 (file)
@@ -1531,6 +1531,7 @@ bRC METAPLUGIN::perform_read_acl(bpContext *ctx)
    if (!backend.ctx->read_ack(ctx)){
       /* should get EOD */
       DMSG0(ctx, DERROR, "Protocol error, should get EOD.\n");
+      backend.ctx->terminate(ctx);
       return bRC_Error;
    }
 
@@ -1567,6 +1568,7 @@ bRC METAPLUGIN::perform_read_xattr(bpContext *ctx)
    if (!backend.ctx->read_ack(ctx)){
       /* should get EOD */
       DMSG0(ctx, DERROR, "Protocol error, should get EOD.\n");
+      backend.ctx->terminate(ctx);
       return bRC_Error;
    }
    readxattr = true;
@@ -1597,6 +1599,7 @@ bRC METAPLUGIN::perform_read_metadata_info(bpContext *ctx, metadata_type type, s
    if (!backend.ctx->read_ack(ctx)){
       /* should get EOD */
       DMSG0(ctx, DERROR, "Protocol error, should get EOD.\n");
+      backend.ctx->terminate(ctx);
       return bRC_Error;
    }
 
@@ -1813,6 +1816,7 @@ bRC METAPLUGIN::perform_read_metacommands(bpContext *ctx)
          /* error in protocol */
          DMSG(ctx, DERROR, "Protocol error, got unknown command: %s\n", cmd.c_str());
          JMSG(ctx, M_FATAL, "Protocol error, got unknown command: %s\n", cmd.c_str());
+         backend.ctx->terminate(ctx);
          return bRC_Error;
       } else {
          if (backend.ctx->is_fatal()){
@@ -2074,6 +2078,7 @@ bRC METAPLUGIN::perform_read_pluginobject(bpContext *ctx, struct save_pkt *sp)
          /* error in protocol */
          DMSG(ctx, DERROR, "Protocol error, got unknown command: %s\n", cmd.c_str());
          JMSG(ctx, M_FATAL, "Protocol error, got unknown command: %s\n", cmd.c_str());
+         backend.ctx->terminate(ctx);
          return bRC_Error;
       } else {
          if (backend.ctx->is_fatal()){
@@ -2458,6 +2463,7 @@ bRC METAPLUGIN::startBackupFile(bpContext *ctx, struct save_pkt *sp)
       if (reqparams > 0) {
          DMSG0(ctx, DERROR, "Protocol error, not enough file attributes from backend.\n");
          JMSG0(ctx, M_FATAL, "Protocol error, not enough file attributes from backend.\n");
+         backend.ctx->terminate(ctx);
          return bRC_Error;
       }
 
index 10084bec6f80b38122982aa568f915474ad22909..97961372279ed6809c8a3399237e70ba8055486c 100644 (file)
@@ -79,6 +79,8 @@ void PTCOMM::terminate(bpContext *ctx)
       return;
    }
 
+   DMSG0(ctx, DINFO, "Terminating backend ...\n");
+
    struct timeval _timeout;
    _timeout.tv_sec = 0;
    _timeout.tv_usec = 1000;
@@ -344,6 +346,7 @@ int32_t PTCOMM::recvbackend_header(bpContext *ctx, char *cmd, bool any)
          DMSG0(ctx, DERROR, "PTCOMM cannot get packet header from backend.\n");
          JMSG0(ctx, M_FATAL, "PTCOMM cannot get packet header from backend.\n");
          f_eod = f_error = f_fatal = true;
+         terminate(ctx);
          return -1;
       }
 
@@ -373,6 +376,7 @@ int32_t PTCOMM::recvbackend_header(bpContext *ctx, char *cmd, bool any)
             if (header.status != *cmd) {
                DMSG2(ctx, DERROR, "Protocol error. Expected packet: %c got: %c\n", *cmd, header.status);
                JMSG2(ctx, M_FATAL, "Protocol error. Expected packet: %c got: %c\n", *cmd, header.status);
+               terminate(ctx);
                return -1;
             }
          } else {
@@ -467,8 +471,9 @@ int32_t PTCOMM::recvbackend_header(bpContext *ctx, char *cmd, bool any)
          continue;
 
       default:
-         DMSG1(ctx, DERROR, "Protocol error. Unknown packet: %c\n", header.status);
-         JMSG1(ctx, M_FATAL, "Protocol error. Unknown packet: %c\n", header.status);
+         DMSG2(ctx, DERROR, "Protocol error. Unknown packet: %c:%s\n", header.status, header.length);
+         JMSG2(ctx, M_FATAL, "Protocol error. Unknown packet: %c:%s\n", header.status, header.length);
+         terminate(ctx);
          return -1;
       }
    }