diff --git a/client/portgroup.cpp b/client/portgroup.cpp index fe2fe77..23d4d33 100644 --- a/client/portgroup.cpp +++ b/client/portgroup.cpp @@ -1578,13 +1578,14 @@ void PortGroup::clearPortStats(QList *portList) } serviceStub->clearStats(controller, portIdList, ack, - NewCallback(this, &PortGroup::processClearStatsAck, controller)); + NewCallback(this, &PortGroup::processClearPortStatsAck, + controller)); } _exit: return; } -void PortGroup::processClearStatsAck(PbRpcController *controller) +void PortGroup::processClearPortStatsAck(PbRpcController *controller) { qDebug("In %s", __FUNCTION__); @@ -1594,6 +1595,38 @@ void PortGroup::processClearStatsAck(PbRpcController *controller) delete controller; } +bool PortGroup::clearStreamStats(QList *portList) +{ + qDebug("In %s", __FUNCTION__); + + if (state() != QAbstractSocket::ConnectedState) + return false; + + OstProto::StreamGuidList *guidList = new OstProto::StreamGuidList; + OstProto::Ack *ack = new OstProto::Ack; + PbRpcController *controller = new PbRpcController(guidList, ack); + + if (portList == NULL) + guidList->mutable_port_id_list()->CopyFrom(*portIdList_); + else + for (int i = 0; i < portList->size(); i++) + guidList->mutable_port_id_list()->add_port_id() + ->set_id(portList->at(i)); + + serviceStub->clearStreamStats(controller, guidList, ack, + NewCallback(this, &PortGroup::processClearStreamStatsAck, + controller)); + + return true; +} + +void PortGroup::processClearStreamStatsAck(PbRpcController *controller) +{ + qDebug("In %s", __FUNCTION__); + + delete controller; +} + bool PortGroup::getStreamStats(QList *portList) { qDebug("In %s", __FUNCTION__); diff --git a/client/portgroup.h b/client/portgroup.h index 1f9ab11..31b5621 100644 --- a/client/portgroup.h +++ b/client/portgroup.h @@ -164,7 +164,9 @@ public: void getPortStats(); void processPortStatsList(); void clearPortStats(QList *portList = NULL); - void processClearStatsAck(PbRpcController *controller); + void processClearPortStatsAck(PbRpcController *controller); + bool clearStreamStats(QList *portList = NULL); + void processClearStreamStatsAck(PbRpcController *controller); bool getStreamStats(QList *portList = NULL); void processStreamStatsList(PbRpcController *controller); diff --git a/client/portstatswindow.cpp b/client/portstatswindow.cpp index 5c03bd4..079cc8d 100644 --- a/client/portstatswindow.cpp +++ b/client/portstatswindow.cpp @@ -196,6 +196,8 @@ void PortStatsWindow::on_tbClear_clicked() { pgl->portGroupByIndex(portList.at(i).portGroupId). clearPortStats(&portList[i].portList); + pgl->portGroupByIndex(portList.at(i).portGroupId). + clearStreamStats(&portList[i].portList); } } @@ -222,6 +224,8 @@ void PortStatsWindow::on_tbClearAll_clicked() { pgl->portGroupByIndex(portList.at(i).portGroupId) .clearPortStats(&portList[i].portList); + pgl->portGroupByIndex(portList.at(i).portGroupId) + .clearStreamStats(&portList[i].portList); } }