Skip to content

Instantly share code, notes, and snippets.

@sebseb7
Created June 25, 2018 22:00
Show Gist options
  • Select an option

  • Save sebseb7/17677905d8d41067fcf5423360b37f7b to your computer and use it in GitHub Desktop.

Select an option

Save sebseb7/17677905d8d41067fcf5423360b37f7b to your computer and use it in GitHub Desktop.
diff --git a/src/CryptoNoteConfig.h b/src/CryptoNoteConfig.h
index 0747e5f..e9d6b56 100644
--- a/src/CryptoNoteConfig.h
+++ b/src/CryptoNoteConfig.h
@@ -132,7 +132,7 @@ const size_t P2P_LOCAL_WHITE_PEERLIST_LIMIT = 1000;
const size_t P2P_LOCAL_GRAY_PEERLIST_LIMIT = 5000;
const size_t P2P_CONNECTION_MAX_WRITE_BUFFER_SIZE = 32 * 1024 * 1024; // 32 MB
-const uint32_t P2P_DEFAULT_CONNECTIONS_COUNT = 8;
+const uint32_t P2P_DEFAULT_CONNECTIONS_COUNT = 32;
const size_t P2P_DEFAULT_WHITELIST_CONNECTIONS_PERCENT = 70;
const uint32_t P2P_DEFAULT_HANDSHAKE_INTERVAL = 60; // seconds
const uint32_t P2P_DEFAULT_PACKET_MAX_SIZE = 50000000; // 50000000 bytes maximum packet size
diff --git a/src/CryptoNoteCore/SwappedMap.h b/src/CryptoNoteCore/SwappedMap.h
index eb5cfcd..a1ec556 100755
--- a/src/CryptoNoteCore/SwappedMap.h
+++ b/src/CryptoNoteCore/SwappedMap.h
@@ -195,7 +195,6 @@ template<class Key, class T> bool SwappedMap<Key, T>::open(const std::string& it
}
template<class Key, class T> void SwappedMap<Key, T>::close() {
- std::cout << "SwappedMap cache hits: " << m_cacheHits << ", misses: " << m_cacheMisses << " (" << std::fixed << std::setprecision(2) << static_cast<double>(m_cacheMisses) / (m_cacheHits + m_cacheMisses) * 100 << "%)" << std::endl;
}
template<class Key, class T> uint64_t SwappedMap<Key, T>::size() const {
diff --git a/src/P2p/NetNode.cpp b/src/P2p/NetNode.cpp
index f42dad6..c899c46 100644
--- a/src/P2p/NetNode.cpp
+++ b/src/P2p/NetNode.cpp
@@ -485,7 +485,6 @@ std::string print_peerlist_to_string(const std::list<PeerlistEntry>& pl) {
if(m_external_port)
logger(INFO) << "External port defined as " << m_external_port;
- addPortMapping(logger, m_listeningPort);
return true;
}
diff --git a/src/Platform/Linux/System/TcpConnection.cpp b/src/Platform/Linux/System/TcpConnection.cpp
index d03142d..6ed1f42 100755
--- a/src/Platform/Linux/System/TcpConnection.cpp
+++ b/src/Platform/Linux/System/TcpConnection.cpp
@@ -81,7 +81,7 @@ size_t TcpConnection::read(uint8_t* data, size_t size) {
std::string message;
ssize_t transferred = ::recv(connection, (void *)data, size, 0);
if (transferred == -1) {
- if (errno != EAGAIN && errno != EWOULDBLOCK) {
+ if (errno != EAGAIN ) {
message = "recv failed, " + lastErrorMessage();
} else {
epoll_event connectionEvent;
@@ -177,7 +177,7 @@ std::size_t TcpConnection::write(const uint8_t* data, size_t size) {
ssize_t transferred = ::send(connection, (void *)data, size, MSG_NOSIGNAL);
if (transferred == -1) {
- if (errno != EAGAIN && errno != EWOULDBLOCK) {
+ if (errno != EAGAIN ) {
message = "send failed, " + lastErrorMessage();
} else {
epoll_event connectionEvent;
diff --git a/src/Platform/Linux/System/Timer.cpp b/src/Platform/Linux/System/Timer.cpp
index 2f8e32e..8f9e2b5 100755
--- a/src/Platform/Linux/System/Timer.cpp
+++ b/src/Platform/Linux/System/Timer.cpp
@@ -102,7 +102,7 @@ void Timer::sleep(std::chrono::nanoseconds duration) {
if (!timerContext->interrupted) {
uint64_t value = 0;
if(::read(timer, &value, sizeof value) == -1 ){
- if(errno == EAGAIN || errno == EWOULDBLOCK) {
+ if(errno == EAGAIN ) {
timerContext->interrupted = true;
dispatcher->pushContext(timerContext->context);
} else {
diff --git a/src/crypto/crypto.cpp b/src/crypto/crypto.cpp
index fb9987b..494b339 100755
--- a/src/crypto/crypto.cpp
+++ b/src/crypto/crypto.cpp
@@ -341,10 +341,10 @@ namespace Crypto {
struct {
EllipticCurvePoint a, b;
} ab[];
- };
+ }rcs;
static inline size_t rs_comm_size(size_t pubs_count) {
- return sizeof(rs_comm) + pubs_count * sizeof(rs_comm().ab[0]);
+ return sizeof(rs_comm) + pubs_count * sizeof(rcs.ab[0]);
}
void crypto_ops::generate_ring_signature(const Hash &prefix_hash, const KeyImage &image,
diff --git a/src/crypto/oaes_lib.c b/src/crypto/oaes_lib.c
index f398bfa..2dbc51d 100644
--- a/src/crypto/oaes_lib.c
+++ b/src/crypto/oaes_lib.c
@@ -27,9 +27,6 @@
* POSSIBILITY OF SUCH DAMAGE.
* ---------------------------------------------------------------------------
*/
-static const char _NR[] = {
- 0x4e,0x61,0x62,0x69,0x6c,0x20,0x53,0x2e,0x20,
- 0x41,0x6c,0x20,0x52,0x61,0x6d,0x6c,0x69,0x00 };
#include <stddef.h>
#include <time.h>
diff --git a/src/crypto/slow-hash.cpp b/src/crypto/slow-hash.cpp
index f69d493..c50bcf8 100644
--- a/src/crypto/slow-hash.cpp
+++ b/src/crypto/slow-hash.cpp
@@ -66,9 +66,6 @@ namespace Crypto {
}
cn_context::~cn_context() {
- if (munmap(data, MAP_SIZE) != 0) {
- throw bad_alloc();
- }
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment