From: Kern Sibbald Date: Sun, 30 Mar 2014 13:55:52 +0000 (+0200) Subject: Update tray-monitor to new bsock calls X-Git-Tag: Release-7.0.1~18 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5f4fd462d65f629769efc268a8d22d8cbaa92542;p=bacula%2Fbacula Update tray-monitor to new bsock calls --- diff --git a/bacula/src/qt-console/tray-monitor/authenticate.cpp b/bacula/src/qt-console/tray-monitor/authenticate.cpp index 91f4da62c4..22688b1bdb 100644 --- a/bacula/src/qt-console/tray-monitor/authenticate.cpp +++ b/bacula/src/qt-console/tray-monitor/authenticate.cpp @@ -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) || diff --git a/bacula/src/qt-console/tray-monitor/tray-monitor.cpp b/bacula/src/qt-console/tray-monitor/tray-monitor.cpp index 9a01a8a7b2..6028752ea2 100644 --- a/bacula/src/qt-console/tray-monitor/tray-monitor.cpp +++ b/bacula/src/qt-console/tray-monitor/tray-monitor.cpp @@ -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;