processCommand method
void
processCommand(
- List<int> data
)
Implementation
void processCommand(List<int> data) {
try {
_commandBuffer.write(utf8.decode(data));
final raw = _commandBuffer.toString();
final lines = raw.split('\r\n');
// Keep the last (potentially incomplete) fragment in the buffer
_commandBuffer.clear();
_commandBuffer.write(lines.last);
for (final line in lines.sublist(0, lines.length - 1)) {
final trimmed = line.trim();
if (trimmed.isEmpty) continue;
_pendingCommands.add(trimmed);
}
_processQueue();
} catch (e, s) {
logger.generalLog("error: $e stack: $s ,input bytes $data");
sendResponse('500 Internal server error');
}
}