]> git.sur5r.net Git - bacula/bacula/commitdiff
Eliminate some old bnet code
authorKern Sibbald <kern@sibbald.com>
Sat, 4 Jun 2011 19:20:30 +0000 (21:20 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 4 Jun 2011 19:20:49 +0000 (21:20 +0200)
bacula/src/stored/bscan.c
bacula/src/tools/testfind.c
bacula/src/tray-monitor/authenticate.c
bacula/src/tray-monitor/tray-monitor.c
bacula/src/wx-console/console_thread.cpp

index 060579601920287eb17a5232bf2f8c8020da36a9..e987feb0b49021140bd13cfb1cf706628741a731 100644 (file)
@@ -865,11 +865,11 @@ static void bscan_free_jcr(JCR *jcr)
 
    if (jcr->file_bsock) {
       Dmsg0(200, "Close File bsock\n");
-      bnet_close(jcr->file_bsock);
+      jcr->file_bsock->close();
    }
    if (jcr->store_bsock) {
       Dmsg0(200, "Close Store bsock\n");
-      bnet_close(jcr->store_bsock);
+      jcr->store_bsock->close();
    }
    if (jcr->RestoreBootstrap) {
       free(jcr->RestoreBootstrap);
index b32230cbd6b0f4abfb9e574f02ab9bb2b893f23a..eb8f10c14cf56c9a327bead79ee493bee6f1f922 100644 (file)
@@ -488,15 +488,15 @@ static bool copy_fileset(FF_PKT *ff, JCR *jcr)
             set_options(current_opts, fo->opts);
 
             for (k=0; k<fo->regex.size(); k++) {
-               // bnet_fsend(fd, "R %s\n", fo->regex.get(k));
+               // fd->fsend("R %s\n", fo->regex.get(k));
                current_opts->regex.append(bstrdup((const char *)fo->regex.get(k)));
             }
             for (k=0; k<fo->regexdir.size(); k++) {
-               // bnet_fsend(fd, "RD %s\n", fo->regexdir.get(k));
+               // fd->fsend("RD %s\n", fo->regexdir.get(k));
                current_opts->regexdir.append(bstrdup((const char *)fo->regexdir.get(k)));
             }
             for (k=0; k<fo->regexfile.size(); k++) {
-               // bnet_fsend(fd, "RF %s\n", fo->regexfile.get(k));
+               // fd->fsend("RF %s\n", fo->regexfile.get(k));
                current_opts->regexfile.append(bstrdup((const char *)fo->regexfile.get(k)));
             }
             for (k=0; k<fo->wild.size(); k++) {
index cde7f6b1b9ce820049a6b9cd5007818424c45f88..d380294d32276ae719309776acdbacb1d555980c 100644 (file)
@@ -129,7 +129,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) ||
@@ -175,7 +175,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 921e25cd664547163560c66ec2188ef34b06644f..131caacee6123bd296dba5fea8bfaa58e2b9d3b5 100644 (file)
@@ -522,8 +522,8 @@ int main(int argc, char *argv[])
             break;
          }
          //writecmd(&items[i], "quit");
-         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();
       }
    }
 
@@ -1015,7 +1015,7 @@ int docmd(monitoritem* item, const char* command, GSList** list)
       writecmd(item, command);
 
    while(1) {
-      if ((stat = bnet_recv(item->D_sock)) >= 0) {
+      if ((stat = item->D_sock->recv()) >= 0) {
          *list = g_slist_append(*list, g_string_new(item->D_sock->msg));
       }
       else if (stat == BNET_SIGNAL) {
@@ -1029,7 +1029,7 @@ int docmd(monitoritem* item, const char* command, GSList** list)
             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);
             *list = g_slist_append(*list, g_string_new(_("<< Heartbeat signal received, answered. >>\n")));
          }
          else {
@@ -1048,7 +1048,7 @@ int docmd(monitoritem* item, const char* command, GSList** list)
          return 0;
       }
 
-      if (is_bnet_stop(item->D_sock)) {
+      if (item->D_sock->is_stop()) {
          g_string_append_printf(str, _("<STOP>\n"));
          item->D_sock = NULL;
          item->state = error;
@@ -1064,7 +1064,7 @@ void writecmd(monitoritem* item, const char* command) {
    if (item->D_sock) {
       item->D_sock->msglen = strlen(command);
       pm_strcpy(&item->D_sock->msg, command);
-      bnet_send(item->D_sock);
+      item->D_sock->send();
    }
 }
 
index 675c15c36a35835b5ceb08c69b4909828497af9b..bb4a8ce7709982a777817a0d2dd3b27b4abb88f0 100644 (file)
@@ -278,8 +278,8 @@ console_thread::console_thread() {
 // class destructor
 console_thread::~console_thread() {
    if (UA_sock) {
-      bnet_sig(UA_sock, BNET_TERMINATE); /* send EOF */
-      bnet_close(UA_sock);
+      UA_sock->signal(BNET_TERMINATE); /* send EOF */
+      UA_sock->close();
       UA_sock = NULL;
    }
 }
@@ -466,7 +466,7 @@ void* console_thread::Entry() {
 
    /* main loop */
    while(!TestDestroy()) {   /* Tests if thread has been ended */
-      stat = bnet_wait_data(UA_sock, 10);
+      stat = UA_sock->wait_data(10);
       if (stat == 0) {
          if (last_is_eod) {
             Write(".messages\n");
@@ -476,7 +476,7 @@ void* console_thread::Entry() {
       }
       
       last_is_eod = 0;
-      if ((stat = bnet_recv(UA_sock)) >= 0) {
+      if ((stat = UA_sock->recv()) >= 0) {
          if (do_not_forward_eod) { /* .messages got data: remove the prompt */
             csprint(NULL, CS_REMOVEPROMPT);
          }
@@ -490,7 +490,7 @@ void* console_thread::Entry() {
             if (!do_not_forward_eod)
                csprint(NULL, CS_END);
          } else if (UA_sock->msglen == BNET_HEARTBEAT) {
-            bnet_sig(UA_sock, BNET_HB_RESPONSE);
+            UA_sock->signal(BNET_HB_RESPONSE);
             csprint(_("<< Heartbeat signal received, answered. >>\n"), CS_DEBUG);
          } else if (UA_sock->msglen == BNET_START_SELECT ||
                     UA_sock->msglen == BNET_END_SELECT) {
@@ -506,7 +506,7 @@ void* console_thread::Entry() {
          break;
       }
            
-      if (is_bnet_stop(UA_sock)) {
+      if (UA_sock->is_stop()) {
          csprint(NULL, CS_END);
          break;            /* error or term */
       }
@@ -534,7 +534,7 @@ void console_thread::Write(const char* str)
    if (UA_sock) {
       UA_sock->msglen = (int32_t)strlen(str);
       pm_strcpy(&UA_sock->msg, str);
-      bnet_send(UA_sock);
+      UA_sock->_send();
    } else if (choosingdirector) {
 //      wxString number = str;
 //      number.RemoveLast(); /* Removes \n */
@@ -553,8 +553,8 @@ void console_thread::Write(const char* str)
 void console_thread::Delete() {
    Write("quit\n");
    if (UA_sock) {
-      bnet_sig(UA_sock, BNET_TERMINATE); /* send EOF */
-      bnet_close(UA_sock);
+      UA_sock->signal(BNET_TERMINATE); /* send EOF */
+      UA_sock->close();
       UA_sock = NULL;
       /*csprint(NULL, CS_END);
       csprint(NULL, CS_DISCONNECTED);