From: Kern Sibbald Date: Sat, 4 Jun 2011 19:20:30 +0000 (+0200) Subject: Eliminate some old bnet code X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f466f919cac4231fa6a4a4343b6413230b2e1588;p=bacula%2Fbacula Eliminate some old bnet code --- diff --git a/bacula/src/stored/bscan.c b/bacula/src/stored/bscan.c index 0605796019..e987feb0b4 100644 --- a/bacula/src/stored/bscan.c +++ b/bacula/src/stored/bscan.c @@ -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); diff --git a/bacula/src/tools/testfind.c b/bacula/src/tools/testfind.c index b32230cbd6..eb8f10c14c 100644 --- a/bacula/src/tools/testfind.c +++ b/bacula/src/tools/testfind.c @@ -488,15 +488,15 @@ static bool copy_fileset(FF_PKT *ff, JCR *jcr) set_options(current_opts, fo->opts); for (k=0; kregex.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; kregexdir.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; kregexfile.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; kwild.size(); k++) { diff --git a/bacula/src/tray-monitor/authenticate.c b/bacula/src/tray-monitor/authenticate.c index cde7f6b1b9..d380294d32 100644 --- a/bacula/src/tray-monitor/authenticate.c +++ b/bacula/src/tray-monitor/authenticate.c @@ -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) || diff --git a/bacula/src/tray-monitor/tray-monitor.c b/bacula/src/tray-monitor/tray-monitor.c index 921e25cd66..131caacee6 100644 --- a/bacula/src/tray-monitor/tray-monitor.c +++ b/bacula/src/tray-monitor/tray-monitor.c @@ -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, _("\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(); } } diff --git a/bacula/src/wx-console/console_thread.cpp b/bacula/src/wx-console/console_thread.cpp index 675c15c36a..bb4a8ce770 100644 --- a/bacula/src/wx-console/console_thread.cpp +++ b/bacula/src/wx-console/console_thread.cpp @@ -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);