From 1986845bae357ba4356bc9239a767e3c54fcf54b Mon Sep 17 00:00:00 2001 From: Srivats P Date: Sat, 5 Nov 2016 19:41:02 +0530 Subject: [PATCH] sign: remove streamsType and associated code --- client/port.h | 2 -- client/portconfigdialog.cpp | 24 ------------------------ client/portconfigdialog.ui | 7 ------- client/portswindow.cpp | 1 - common/protocol.proto | 6 ------ server/abstractport.cpp | 14 -------------- server/abstractport.h | 2 -- server/pcapport.cpp | 20 -------------------- server/pcapport.h | 2 -- 9 files changed, 78 deletions(-) diff --git a/client/port.h b/client/port.h index 77ae2d5..281a61a 100644 --- a/client/port.h +++ b/client/port.h @@ -98,8 +98,6 @@ public: { return d.is_exclusive_control(); } OstProto::TransmitMode transmitMode() { return d.transmit_mode(); } - OstProto::StreamType streamsType() - { return d.streams_type(); } double averagePacketRate() { return avgPacketsPerSec_; } double averageBitRate() diff --git a/client/portconfigdialog.cpp b/client/portconfigdialog.cpp index 92ba739..96028fd 100644 --- a/client/portconfigdialog.cpp +++ b/client/portconfigdialog.cpp @@ -68,23 +68,9 @@ PortConfigDialog::PortConfigDialog( exclusiveControlButton->setChecked(portConfig_.is_exclusive_control()); - switch(portConfig_.streams_type()) - { - case OstProto::kUnsignedStream: - signedStreamsButton->setChecked(false); - break; - case OstProto::kSignedStream: - signedStreamsButton->setChecked(true); - break; - default: - Q_ASSERT(false); // Unreachable!!! - break; - } - // Disable UI elements based on portState if (portState.is_transmit_on()) { transmitModeBox->setDisabled(true); - signedStreamsButton->setDisabled(true); } } @@ -118,11 +104,6 @@ void PortConfigDialog::accept() pc.set_is_exclusive_control(exclusiveControlButton->isChecked()); - if (signedStreamsButton->isChecked()) - pc.set_streams_type(OstProto::kSignedStream); - else - pc.set_streams_type(OstProto::kUnsignedStream); - // Update fields that have changed, clear the rest if (pc.transmit_mode() != portConfig_.transmit_mode()) portConfig_.set_transmit_mode(pc.transmit_mode()); @@ -139,10 +120,5 @@ void PortConfigDialog::accept() else portConfig_.clear_is_exclusive_control(); - if (pc.streams_type() != portConfig_.streams_type()) - portConfig_.set_streams_type(pc.streams_type()); - else - portConfig_.clear_streams_type(); - QDialog::accept(); } diff --git a/client/portconfigdialog.ui b/client/portconfigdialog.ui index 711cd3d..14ded8f 100644 --- a/client/portconfigdialog.ui +++ b/client/portconfigdialog.ui @@ -69,13 +69,6 @@ - - - - Signed Streams - - - diff --git a/client/portswindow.cpp b/client/portswindow.cpp index 9e4fd04..c1bb4b7 100644 --- a/client/portswindow.cpp +++ b/client/portswindow.cpp @@ -726,7 +726,6 @@ void PortsWindow::on_actionPort_Configuration_triggered() // which says copy only modifiable fields //plm->port(current).protoDataCopyInto(&config); config.set_transmit_mode(port.transmitMode()); - config.set_streams_type(port.streamsType()); config.set_is_exclusive_control(port.hasExclusiveControl()); config.set_user_name(port.userName().toStdString()); diff --git a/common/protocol.proto b/common/protocol.proto index 8850212..a08307b 100644 --- a/common/protocol.proto +++ b/common/protocol.proto @@ -196,11 +196,6 @@ enum TransmitMode { kInterleavedTransmit = 1; } -enum StreamType { - kUnsignedStream = 0; // FIXME: rename? convert to flags? - kSignedStream = 1; -} - message Port { required PortId port_id = 1; optional string name = 2; @@ -210,7 +205,6 @@ message Port { optional bool is_exclusive_control = 6; optional TransmitMode transmit_mode = 7 [default = kSequentialTransmit]; optional string user_name = 8; - optional StreamType streams_type = 9 [default = kUnsignedStream]; } message PortConfigList { diff --git a/server/abstractport.cpp b/server/abstractport.cpp index 1764d52..6f1c7c4 100644 --- a/server/abstractport.cpp +++ b/server/abstractport.cpp @@ -78,12 +78,6 @@ bool AbstractPort::canModify(const OstProto::Port &port, bool *dirty) allow = !isTransmitOn(); } - if (port.has_streams_type() - && (port.streams_type() != data_.streams_type())) { - *dirty = true; - allow = !isTransmitOn(); - } - return allow; } @@ -104,9 +98,6 @@ bool AbstractPort::modify(const OstProto::Port &port) if (port.has_transmit_mode()) data_.set_transmit_mode(port.transmit_mode()); - if (port.has_streams_type()) - setStreamsType(port.streams_type()); - if (port.has_user_name()) { data_.set_user_name(port.user_name()); } @@ -180,11 +171,6 @@ void AbstractPort::addNote(QString note) data_.set_notes(notes.toStdString()); } -bool AbstractPort::setStreamsType(OstProto::StreamType type) -{ - data_.set_streams_type(type); -} - AbstractPort::Accuracy AbstractPort::rateAccuracy() { return rateAccuracy_; diff --git a/server/abstractport.h b/server/abstractport.h index da5c70e..a604bd2 100644 --- a/server/abstractport.h +++ b/server/abstractport.h @@ -103,8 +103,6 @@ public: bool isDirty() { return isSendQueueDirty_; } void setDirty() { isSendQueueDirty_ = true; } - virtual bool setStreamsType(OstProto::StreamType type); - Accuracy rateAccuracy(); virtual bool setRateAccuracy(Accuracy accuracy); diff --git a/server/pcapport.cpp b/server/pcapport.cpp index b297d50..700358f 100644 --- a/server/pcapport.cpp +++ b/server/pcapport.cpp @@ -117,26 +117,6 @@ void PcapPort::updateNotes() arg(notes).toStdString()); } -bool PcapPort::setStreamsType(OstProto::StreamType type) -{ - AbstractPort::setStreamsType(type); - transmitter_->useSignedStreams(type == OstProto::kSignedStream); - - // XXX: Because of the way we implement signed tx stats, changing - // streamsType requires us to set sign tx stats equal to tx stats - // followed by clear stats; see note in PcapTxStats::run() for details - // FIXME: can we get away with clearing only sign stats? - // FIXME: Ideally PcapPort should *NOT* know how PcapTxStats implements - // sign stats - stats_.sign.txPkts = stats_.txPkts; - stats_.sign.txBytes = stats_.txBytes; - stats_.sign.rxPkts = stats_.rxPkts; - stats_.sign.rxBytes = stats_.rxBytes; - resetStats(); - - return true; -} - bool PcapPort::setRateAccuracy(AbstractPort::Accuracy accuracy) { if (transmitter_->setRateAccuracy(accuracy)) { diff --git a/server/pcapport.h b/server/pcapport.h index bedeeee..04e8269 100644 --- a/server/pcapport.h +++ b/server/pcapport.h @@ -39,8 +39,6 @@ public: virtual bool hasExclusiveControl() { return false; } virtual bool setExclusiveControl(bool /*exclusive*/) { return false; } - virtual bool setStreamsType(OstProto::StreamType type); - virtual bool setRateAccuracy(AbstractPort::Accuracy accuracy); virtual void clearPacketList() {