Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions bflibcpp/todo.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
11 changes: 5 additions & 6 deletions bfnet/src/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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));
}

Expand Down Expand Up @@ -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");
Expand Down
15 changes: 7 additions & 8 deletions bfnet/src/connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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, ...]
Expand All @@ -67,6 +66,11 @@ class Connection : public BF::Object {
*/
int type() const;

/**
* closes socket descriptor
*/
void closeConnection();

private:

/**
Expand All @@ -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);

/**
Expand Down
2 changes: 1 addition & 1 deletion bfnet/src/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down