MCPcopy Create free account
hub / github.com/BatchDrake/SigDigger / processSocketData

Method processSocketData

Components/RMSViewTab.cpp:170–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170void
171RMSViewTab::processSocketData(void)
172{
173 char c;
174 bool firstTime = this->data.size() == 0;
175
176 while (this->socket->bytesAvailable() > 0) {
177 if (this->socket->read(&c, 1) < 1) {
178 this->disconnectSocket();
179 return;
180 }
181
182 if (c == '\n') {
183 this->parseLine();
184 this->line.clear();
185 } else if (isprint(c)) {
186 this->line += c;
187 if (this->line.size() >= MAX_LINE_SIZE) {
188 this->line.clear();
189 this->disconnect();
190 QMessageBox::critical(
191 this,
192 "Max line size exceeded",
193 "Remote peer attempted to flood us. Preventively disconnected");
194 }
195 }
196 }
197
198 if (firstTime && this->data.size() > 0) {
199 qint64 width = this->ui->waveform->getVerticalAxisWidth();
200 this->ui->waveform->zoomHorizontal(
201 -width,
202 static_cast<qint64>(this->ui->waveform->size().width()) - width);
203 }
204}
205
206void
207RMSViewTab::disconnectSocket(void)

Callers 2

RMSViewTabMethod · 0.95
onTimeoutMethod · 0.95

Calls 6

disconnectSocketMethod · 0.95
parseLineMethod · 0.95
widthMethod · 0.80
sizeMethod · 0.45
readMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected