diff --git a/bflibcpp/todo.md b/bflibcpp/todo.md index 4cd3275..0c65fcc 100644 --- a/bflibcpp/todo.md +++ b/bflibcpp/todo.md @@ -1,5 +1,3 @@ - -- [ ] BF::Array to use new/delete for memory allocation - [x] improve List sorting - [x] move sort logic to array and list - [x] reevaluate logic location, moved to sort.hpp @@ -15,10 +13,12 @@ - [ ] json to map - [ ] standard pair - [ ] tuple -- [ ] address compiler warning regarding ambiguous operations +- [x] address compiler warning regarding ambiguous operations - [ ] String to integer -- [ ] optimize String - - [ ] when appending to string, grab more memory so we don't have keep calling realloc all the time +- [ ] array memory optimization, improving virtual memory usage + - [ ] BF::Array to use new/delete for memory allocation + - [ ] optimize String + - [ ] when appending to string, grab more memory so we don't have keep calling realloc all the time - [x] collection sorting algorithm - [x] make sure there are no Delete() calls and must use BFRelease instead - [x] throw compiler warnings when using delete diff --git a/bfnet/src/connection.cpp b/bfnet/src/connection.cpp index 41cd0aa..0d17632 100644 --- a/bfnet/src/connection.cpp +++ b/bfnet/src/connection.cpp @@ -52,7 +52,6 @@ bool BF::Net::Connection::isready() const { bool BF::Net::Connection::isactive() const { if (this->_sd.get() == 0) { - BFNetLogDebug("%s - socket descriptor is 0", __FUNCTION__); return false; } @@ -74,11 +73,11 @@ bool BF::Net::Connection::isactive() const { return true; } -const char BF::Net::Connection::mode() { +const char BF::Net::Connection::mode() const { return this->_sktref->mode(); } -void BF::Net::Connection::getuuid(uuid_t uuid) { +void BF::Net::Connection::getuuid(uuid_t uuid) const { memcpy(uuid, this->_uuid, sizeof(uuid_t)); } @@ -147,11 +146,11 @@ int BF::Net::Connection::sendData(const Data * buf) { int BF::Net::Connection::recvData(Data * data) { if (this->_sd.get() == 0) { - return 1; + return 100; } else if (!this->isactive()) { - return 1; + return 101; } else if (!data) { - return 1; + return 102; } BFNetLogDebug("> recvData"); diff --git a/bfnet/src/connection.hpp b/bfnet/src/connection.hpp index 0b13f40..406d11a 100644 --- a/bfnet/src/connection.hpp +++ b/bfnet/src/connection.hpp @@ -46,18 +46,17 @@ class Connection : public BF::Object { * data : data to be sent. this data is copied. Caller still owns * size : size of data buffer */ - //int queueData(const void * data, size_t size); int queueData(const BF::Data * buf); /** * see Socket::mode */ - const char mode(); + const char mode() const; /** * returns uuid */ - void getuuid(uuid_t uuid); + void getuuid(uuid_t uuid) const; /** * returns socket type [SOCK_STREAM, SOCK_DGRAM, ...] @@ -67,6 +66,11 @@ class Connection : public BF::Object { */ int type() const; + /** + * closes socket descriptor + */ + void closeConnection(); + private: /** @@ -75,11 +79,6 @@ class Connection : public BF::Object { Connection(int sd, Socket * sktref); virtual ~Connection(); - /** - * closes socket descriptor - */ - void closeConnection(); - int sendData(const BF::Data * buf); /** diff --git a/bfnet/src/socket.cpp b/bfnet/src/socket.cpp index 3ae6b3b..210c86d 100644 --- a/bfnet/src/socket.cpp +++ b/bfnet/src/socket.cpp @@ -138,7 +138,7 @@ void BF::Net::Socket::inStream(void * in) { int err = sc->recvData(&envelope->_data); if (err) { - BFNetLogDebug("%s - error returned from recvData: %d. Aborting reading socket...", __FUNCTION__, err); + BFNetLogDebug("%s - exiting recv loop %d", __FUNCTION__, err); BFRelease(envelope); break; } else {