]> git.sur5r.net Git - bacula/bacula/commitdiff
Update tray-monitor to new bsock calls
authorKern Sibbald <kern@sibbald.com>
Sun, 30 Mar 2014 13:55:52 +0000 (15:55 +0200)
committerKern Sibbald <kern@sibbald.com>
Sun, 30 Mar 2014 13:55:52 +0000 (15:55 +0200)
bacula/src/qt-console/tray-monitor/authenticate.cpp
bacula/src/qt-console/tray-monitor/tray-monitor.cpp

index 91f4da62c405d9dbd837d8826b0d9ab416006460..22688b1bdbfb72e1f27e2dcad3c66a808fc7bfdf 100644 (file)
@@ -116,7 +116,7 @@ int authenticate_storage_daemon(JCR *jcr, MONITOR *monitor, STORE* store)
    btimer_t *tid = start_bsock_timer(sd, 60 * 5);
    if (!sd->fsend(SDFDhello, dirname)) {
       stop_bsock_timer(tid);
-      Jmsg(jcr, M_FATAL, 0, _("Error sending Hello to Storage daemon. ERR=%s\n"), bnet_strerror(sd));
+      Jmsg(jcr, M_FATAL, 0, _("Error sending Hello to Storage daemon. ERR=%s\n"), sd->bstrerror());
       return 0;
    }
    if (!cram_md5_respond(sd, store->password, &tls_remote_need, &compatible) ||
@@ -162,7 +162,7 @@ int authenticate_file_daemon(JCR *jcr, MONITOR *monitor, CLIENT* client)
    btimer_t *tid = start_bsock_timer(fd, 60 * 5);
    if (!fd->fsend(SDFDhello, dirname)) {
       stop_bsock_timer(tid);
-      Jmsg(jcr, M_FATAL, 0, _("Error sending Hello to File daemon. ERR=%s\n"), bnet_strerror(fd));
+      Jmsg(jcr, M_FATAL, 0, _("Error sending Hello to File daemon. ERR=%s\n"), fd->bstrerror());
       return 0;
    }
    if (!cram_md5_respond(fd, client->password, &tls_remote_need, &compatible) ||
index 9a01a8a7b25df0f7eea8cb1f99a87c6154ddc3e8..6028752ea294fb06accb5a1b4db5b9e5cb9a222b 100644 (file)
@@ -87,7 +87,7 @@ void get_list(monitoritem *item, const char *cmd, QStringList &lst)
 
    doconnect(item);
    item->writecmd(cmd);
-   while((stat = bnet_recv(item->D_sock)) >= 0) {
+   while((stat = item->D_sock->recv()) >= 0) {
       strip_trailing_junk(item->D_sock->msg);
       if (*(item->D_sock->msg)) {
          lst << QString(item->D_sock->msg);
@@ -291,8 +291,8 @@ int main(int argc, char *argv[])
       if (items[i].D_sock) {
          items[i].writecmd("quit");
          if (items[i].D_sock) {
-            bnet_sig(items[i].D_sock, BNET_TERMINATE); /* send EOF */
-            bnet_close(items[i].D_sock);
+            items[i].D_sock->signal(BNET_TERMINATE); /* send EOF */
+            items[i].D_sock->close();
          }
       }
    }
@@ -345,21 +345,24 @@ int doconnect(monitoritem* item)
       case R_DIRECTOR:
          dird = (DIRRES*)item->resource;
          changeStatusMessage(item, _("Connecting to Director %s:%d"), dird->address, dird->DIRport);
-         item->D_sock = bnet_connect(NULL, monitor->DIRConnectTimeout,
+         item->D_sock = new_bsock();
+         item->D_sock->connect(NULL, monitor->DIRConnectTimeout,
                                      0, 0, _("Director daemon"), dird->address, NULL, dird->DIRport, 0);
          jcr.dir_bsock = item->D_sock;
          break;
       case R_CLIENT:
          filed = (CLIENT*)item->resource;
          changeStatusMessage(item, _("Connecting to Client %s:%d"), filed->address, filed->FDport);
-         item->D_sock = bnet_connect(NULL, monitor->FDConnectTimeout,
+         item->D_sock = new_bsock();
+         item->D_sock->connect(NULL, monitor->FDConnectTimeout,
                                      0, 0, _("File daemon"), filed->address, NULL, filed->FDport, 0);
          jcr.file_bsock = item->D_sock;
          break;
       case R_STORAGE:
          stored = (STORE*)item->resource;
          changeStatusMessage(item, _("Connecting to Storage %s:%d"), stored->address, stored->SDport);
-         item->D_sock = bnet_connect(NULL, monitor->SDConnectTimeout,
+         item->D_sock = new_bsock();
+         item->D_sock->connect(NULL, monitor->SDConnectTimeout,
                                      0, 0, _("Storage daemon"), stored->address, NULL, stored->SDport, 0);
          jcr.store_bsock = item->D_sock;
          break;
@@ -418,7 +421,7 @@ int docmd(monitoritem* item, const char* command)
       item->writecmd(command);
 
    while(1) {
-      if ((stat = bnet_recv(item->D_sock)) >= 0) {
+      if ((stat = item->D_sock->recv()) >= 0) {
          strip_trailing_newline(item->D_sock->msg);
          tray->appendText(item->get_name(), item->D_sock->msg);
       }
@@ -432,7 +435,7 @@ int docmd(monitoritem* item, const char* command)
             return 0;
          }
          else if (item->D_sock->msglen == BNET_HEARTBEAT) {
-            bnet_sig(item->D_sock, BNET_HB_RESPONSE);
+            item->D_sock->signal(BNET_HB_RESPONSE);
          }
          else {
             qDebug() << bnet_sig_to_ascii(item->D_sock);
@@ -447,7 +450,7 @@ int docmd(monitoritem* item, const char* command)
          return 0;
       }
 
-      if (is_bnet_stop(item->D_sock)) {
+      if (item->D_sock->is_stop()) {
          item->D_sock = NULL;
          item->state = error;
          item->oldstate = error;