Update git patch.

This commit is contained in:
Simone Caronni 2014-03-30 18:46:16 +02:00
parent c407d2d12e
commit 5fc992fd8b

View File

@ -2101,11 +2101,15 @@ index 91f4da6..22688b1 100644
}
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 9a01a8a..6028752 100644
index 9a01a8a..ed69d10 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)
@@ -84,10 +84,10 @@ void dotest()
void get_list(monitoritem *item, const char *cmd, QStringList &lst)
{
int stat;
-
+
doconnect(item);
item->writecmd(cmd);
- while((stat = bnet_recv(item->D_sock)) >= 0) {
@ -2113,23 +2117,81 @@ index 9a01a8a..6028752 100644
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[])
@@ -109,7 +109,7 @@ void refresh_item()
break;
case R_STORAGE:
cmd = "status";
- break;
+ break;
default:
exit(1);
break;
@@ -124,7 +124,7 @@ void refresh_item()
*
*/
int main(int argc, char *argv[])
-{
+{
int ch, i, dir_index=-1;
bool test_config = false;
DIRRES* dird;
@@ -138,7 +138,7 @@ int main(int argc, char *argv[])
init_stack_dump();
my_name_is(argc, argv, "tray-monitor");
lmgr_init_thread();
- init_msg(NULL, NULL);
+ init_msg(NULL, NULL, NULL);
working_directory = "/tmp";
struct sigaction sigignore;
@@ -275,7 +275,7 @@ int main(int argc, char *argv[])
break;
case R_STORAGE:
cmd = "status";
- break;
+ break;
default:
exit(1);
break;
@@ -291,15 +291,15 @@ 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();
+ free_bsock(items[i].D_sock);
}
}
}
@@ -345,21 +345,24 @@ int doconnect(monitoritem* item)
(void)WSACleanup(); /* Cleanup Windows sockets */
-
+
config->free_resources();
free(config);
config = NULL;
@@ -332,9 +332,9 @@ void changeStatusMessage(monitoritem*, const char *fmt,...) {
tray->statusbar->showMessage(QString(buf));
}
-int doconnect(monitoritem* item)
+int doconnect(monitoritem* item)
{
- if (!item->D_sock) {
+ if (!is_bsock_open(item->D_sock)) {
memset(&jcr, 0, sizeof(jcr));
DIRRES* dird;
@@ -345,21 +345,30 @@ 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();
+ if (!item->D_sock) {
+ 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;
@ -2138,7 +2200,9 @@ index 9a01a8a..6028752 100644
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();
+ if (!item->D_sock) {
+ 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;
@ -2147,12 +2211,23 @@ index 9a01a8a..6028752 100644
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();
+ if (!item->D_sock) {
+ 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)
@@ -406,7 +415,7 @@ int doconnect(monitoritem* item)
return 1;
}
-int docmd(monitoritem* item, const char* command)
+int docmd(monitoritem* item, const char* command)
{
int stat;
//qDebug() << "docmd(" << item->get_name() << "," << command << ")";
@@ -418,7 +427,7 @@ int docmd(monitoritem* item, const char* command)
item->writecmd(command);
while(1) {
@ -2161,7 +2236,7 @@ index 9a01a8a..6028752 100644
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)
@@ -432,7 +441,7 @@ int docmd(monitoritem* item, const char* command)
return 0;
}
else if (item->D_sock->msglen == BNET_HEARTBEAT) {
@ -2170,7 +2245,7 @@ index 9a01a8a..6028752 100644
}
else {
qDebug() << bnet_sig_to_ascii(item->D_sock);
@@ -447,7 +450,7 @@ int docmd(monitoritem* item, const char* command)
@@ -447,7 +456,7 @@ int docmd(monitoritem* item, const char* command)
return 0;
}