Changeset View
Changeset View
Standalone View
Standalone View
src/server/connection.cpp
Show First 20 Lines • Show All 260 Lines • ▼ Show 20 Line(s) | 235 | while (m_socket->bytesAvailable() >= int(sizeof(qint64))) { | |||
---|---|---|---|---|---|
261 | 261 | | |||
262 | // Tag context and collection context is not persistent. | 262 | // Tag context and collection context is not persistent. | ||
263 | context()->setTag(-1); | 263 | context()->setTag(-1); | ||
264 | context()->setCollection(Collection()); | 264 | context()->setCollection(Collection()); | ||
265 | if (Tracer::self()->currentTracer() != QLatin1String("null")) { | 265 | if (Tracer::self()->currentTracer() != QLatin1String("null")) { | ||
266 | Tracer::self()->connectionInput(m_identifier, tag, cmd); | 266 | Tracer::self()->connectionInput(m_identifier, tag, cmd); | ||
267 | } | 267 | } | ||
268 | 268 | | |||
269 | m_currentHandler = std::unique_ptr<Handler>(findHandlerForCommand(cmd->type())); | 269 | m_currentHandler = findHandlerForCommand(cmd->type()); | ||
270 | if (!m_currentHandler) { | 270 | if (!m_currentHandler) { | ||
271 | qCWarning(AKONADISERVER_LOG) << "Invalid command: no such handler for" << cmd->type() | 271 | qCWarning(AKONADISERVER_LOG) << "Invalid command: no such handler for" << cmd->type() | ||
272 | << "on connection" << m_identifier; | 272 | << "on connection" << m_identifier; | ||
273 | setState(Server::LoggingOut); | 273 | setState(Server::LoggingOut); | ||
274 | return; | 274 | return; | ||
275 | } | 275 | } | ||
276 | if (m_reportTime) { | 276 | if (m_reportTime) { | ||
277 | startTime(); | 277 | startTime(); | ||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Line(s) | 321 | #endif | |||
360 | } | 360 | } | ||
361 | } | 361 | } | ||
362 | 362 | | |||
363 | CommandContext *Connection::context() const | 363 | CommandContext *Connection::context() const | ||
364 | { | 364 | { | ||
365 | return const_cast<CommandContext *>(&m_context); | 365 | return const_cast<CommandContext *>(&m_context); | ||
366 | } | 366 | } | ||
367 | 367 | | |||
368 | Handler *Connection::findHandlerForCommand(Protocol::Command::Type command) | 368 | std::unique_ptr<Handler> Connection::findHandlerForCommand(Protocol::Command::Type command) | ||
369 | { | 369 | { | ||
370 | Handler *handler = Handler::findHandlerForCommandAlwaysAllowed(command); | 370 | auto handler = Handler::findHandlerForCommandAlwaysAllowed(command); | ||
371 | if (handler) { | 371 | if (handler) { | ||
372 | return handler; | 372 | return handler; | ||
373 | } | 373 | } | ||
374 | 374 | | |||
375 | switch (m_connectionState) { | 375 | switch (m_connectionState) { | ||
376 | case NonAuthenticated: | 376 | case NonAuthenticated: | ||
377 | handler = Handler::findHandlerForCommandNonAuthenticated(command); | 377 | handler = Handler::findHandlerForCommandNonAuthenticated(command); | ||
378 | break; | 378 | break; | ||
▲ Show 20 Lines • Show All 139 Lines • Show Last 20 Lines |