small legibility fixes

This commit is contained in:
Jan Westerdiep 2016-06-10 15:21:10 +02:00
parent 06afda3606
commit 7384b521ac
6 changed files with 12 additions and 8 deletions

View File

@ -199,7 +199,7 @@ PARSING INCOMING DATA
The ConnectionHandler class has a method onData() that is called by the library The ConnectionHandler class has a method onData() that is called by the library
every time that it wants to send out data. We've explained that it is up to you to every time that it wants to send out data. We've explained that it is up to you to
implement that method. Inside your ConnectionHandler::data() method, you can for implement that method. Inside your ConnectionHandler::onData() method, you can for
example call the "send()" or "write()" system call to send out the data to example call the "send()" or "write()" system call to send out the data to
the RabbitMQ server. But what about data in the other direction? How does the the RabbitMQ server. But what about data in the other direction? How does the
library receive data back from RabbitMQ? library receive data back from RabbitMQ?
@ -312,7 +312,7 @@ class MyTcpHandler : public AMQP::TcpHandler
* and only make "write()" or "read()" system calls when it knows in advance * and only make "write()" or "read()" system calls when it knows in advance
* that these calls will not block. To register a filedescriptor in the * that these calls will not block. To register a filedescriptor in the
* event loop, it calls this "monitor()" method with a filedescriptor and * event loop, it calls this "monitor()" method with a filedescriptor and
* flags telling whether the filedescriptor should be checked for reaability * flags telling whether the filedescriptor should be checked for readability
* or writability. * or writability.
* *
* @param connection The connection that wants to interact with the event loop * @param connection The connection that wants to interact with the event loop

View File

@ -2,7 +2,7 @@
* Buffer.h * Buffer.h
* *
* Interface that can be implemented by client applications and that * Interface that can be implemented by client applications and that
* is parsed to the Connection::parse() method. * is passed to the Connection::parse() method.
* *
* Normally, the Connection::parse() method is fed with a byte * Normally, the Connection::parse() method is fed with a byte
* array. However, if you're receiving big frames, it may be inconvenient * array. However, if you're receiving big frames, it may be inconvenient

View File

@ -113,7 +113,7 @@ public:
/** /**
* Register a function to be called when a message arrives * Register a function to be called when a message arrives
* This fuction is also available as onMessage() because I always forget which name I gave to it * This fuction is also available as onReceived() because I always forget which name I gave to it
* @param callback the callback to execute * @param callback the callback to execute
*/ */
DeferredConsumer &onMessage(const MessageCallback &callback) DeferredConsumer &onMessage(const MessageCallback &callback)

View File

@ -86,6 +86,9 @@ public:
// we can not safely append the data to the string, it // we can not safely append the data to the string, it
// will not exceed the reserved size so it is guaranteed // will not exceed the reserved size so it is guaranteed
// not to change the data pointer, we can just leave that // not to change the data pointer, we can just leave that
// @todo this is not always necessary; instead, we can refrain from
// allocating this buffer entirely and just insert it into the message
// directly.
_str.append(buffer, static_cast<size_t>(size)); _str.append(buffer, static_cast<size_t>(size));
// if the string is filled with the given number of characters we are done now // if the string is filled with the given number of characters we are done now

View File

@ -72,6 +72,7 @@
#include "framecheck.h" #include "framecheck.h"
#define TYPE_INVALID 0 #define TYPE_INVALID 0
#define END_OF_FRAME -50
/** /**
* Set up namespace * Set up namespace
@ -99,12 +100,12 @@ ReceivedFrame::ReceivedFrame(const Buffer &buffer, uint32_t max) : _buffer(buffe
if (buffer.size() >= _payloadSize + 8) if (buffer.size() >= _payloadSize + 8)
{ {
// buffer is big enough, check for a valid end-of-frame marker // buffer is big enough, check for a valid end-of-frame marker
if ((int)buffer.byte(_payloadSize+7) != -50) throw ProtocolException("invalid end of frame marker"); if ((int)buffer.byte(_payloadSize+7) != END_OF_FRAME) throw ProtocolException("invalid end of frame marker");
} }
else else
{ {
// frame is not yet valid // frame is not yet valid
_type = 0; _type = TYPE_INVALID;
_channel = 0; _channel = 0;
_payloadSize = 0; _payloadSize = 0;
} }
@ -264,7 +265,7 @@ float ReceivedFrame::nextFloat()
/** /**
* Read a double from the buffer * Read a double from the buffer
* *
* @return double boule read from buffer * @return double double read from buffer
*/ */
double ReceivedFrame::nextDouble() double ReceivedFrame::nextDouble()
{ {

View File

@ -141,7 +141,7 @@ public:
if (flags & readable) if (flags & readable)
{ {
// read data from buffer // read data from buffer
auto result = _in.receivefrom(_socket); ssize_t result = _in.receivefrom(_socket);
// are we in an error state? // are we in an error state?
if (result < 0 && reportError()) return nextState(monitor); if (result < 0 && reportError()) return nextState(monitor);