Skip to content

Commit

Permalink
A small change to keep Cumulus compatibe with Poco 1.3.6p1 even if I …
Browse files Browse the repository at this point in the history
…advise to use a Poco version more greater (or equal) than 1.4.0.
  • Loading branch information
cumulusdev committed Jan 8, 2013
1 parent 07c3c86 commit a98e470
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CumulusLib/include/Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "Cumulus.h"
#include "Poco/NullStream.h"
#include "Poco/Net/SocketAddress.h"
#include "string.h"
#include <vector>
#include <map>

Expand Down Expand Up @@ -49,4 +50,9 @@ inline Poco::UInt8 Util::Get7BitValueSize(Poco::UInt32 value) {
return Get7BitValueSize((Poco::UInt64)value);
}

inline bool Util::SameAddress(const Poco::Net::SocketAddress& address1,const Poco::Net::SocketAddress& address2) {
return std::memcmp(address1.addr(),address2.addr(),address1.length())==0 && address1.port() == address2.port();
}


} // namespace Cumulus
2 changes: 1 addition & 1 deletion CumulusLib/sources/FlowWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ void FlowWriter::acknowledgment(PacketReader& reader) {
}

void FlowWriter::manage(Invoker& invoker) {
if(!consumed() & !_band.failed()) {
if(!consumed() && !_band.failed()) {
try {
if(_trigger.raise())
raiseMessage();
Expand Down
5 changes: 0 additions & 5 deletions CumulusLib/sources/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ Util::Util() {
Util::~Util() {
}

bool Util::SameAddress(const SocketAddress& address1,const SocketAddress& address2) {
return memcmp(address1.addr(),address2.addr(),address1.length())==0 && address1.port() == address2.port();
}


string Util::FormatHex(const UInt8* data,UInt32 size) {
ostringstream oss;
HexBinaryEncoder(oss).write((char*)data,size);
Expand Down
3 changes: 2 additions & 1 deletion CumulusServer/sources/UDPSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

#include "UDPSocket.h"
#include "Util.h"
#include "Logs.h"
#include "Poco/Buffer.h"
#include "Poco/Format.h"
Expand Down Expand Up @@ -94,7 +95,7 @@ void UDPSocket::close() {
bool UDPSocket::bind(const Poco::Net::SocketAddress & address) {
_error.clear();
if(_bound) {
if(_pSocket->address()==address)
if(Util::SameAddress(_pSocket->address(),address))
return true;
_error = format("UDPSocket already bound on %s, close the socket before",_pSocket->address().toString());
return false;
Expand Down

0 comments on commit a98e470

Please sign in to comment.