mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-24 22:26:52 -05:00
Moved define of the debug output from libretroshare.pro to pqissl.cc.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4346 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
66b9f42835
commit
a9b85c83ae
@ -38,7 +38,6 @@ testnetwork {
|
|||||||
|
|
||||||
# DEFINES *= PGRP_DEBUG
|
# DEFINES *= PGRP_DEBUG
|
||||||
# DEFINES *= PERSON_DEBUG
|
# DEFINES *= PERSON_DEBUG
|
||||||
# DEFINES *= DEBUG_PQISSL
|
|
||||||
|
|
||||||
#DEFINES *= DEBUG_UDP_SORTER DEBUG_UDP_LAYER EXTADDRSEARCH_DEBUG
|
#DEFINES *= DEBUG_UDP_SORTER DEBUG_UDP_LAYER EXTADDRSEARCH_DEBUG
|
||||||
|
|
||||||
@ -255,7 +254,6 @@ win32 {
|
|||||||
#QMAKE_CXXFLAGS_DEBUG += -O2
|
#QMAKE_CXXFLAGS_DEBUG += -O2
|
||||||
#QMAKE_CFLAGS_DEBUG += -O2
|
#QMAKE_CFLAGS_DEBUG += -O2
|
||||||
|
|
||||||
DEFINES -= DEBUG_PQISSL
|
|
||||||
DEFINES += USE_CMD_ARGS
|
DEFINES += USE_CMD_ARGS
|
||||||
|
|
||||||
#miniupnp implementation files
|
#miniupnp implementation files
|
||||||
|
@ -53,10 +53,11 @@ const int pqisslzone = 37714;
|
|||||||
#define WAITING_SSL_AUTHORISE 5
|
#define WAITING_SSL_AUTHORISE 5
|
||||||
#define WAITING_FAIL_INTERFACE 6
|
#define WAITING_FAIL_INTERFACE 6
|
||||||
|
|
||||||
|
|
||||||
#define PQISSL_PASSIVE 0x00
|
#define PQISSL_PASSIVE 0x00
|
||||||
#define PQISSL_ACTIVE 0x01
|
#define PQISSL_ACTIVE 0x01
|
||||||
|
|
||||||
|
#define PQISSL_DEBUG 1
|
||||||
|
|
||||||
const int PQISSL_LOCAL_FLAG = 0x01;
|
const int PQISSL_LOCAL_FLAG = 0x01;
|
||||||
const int PQISSL_REMOTE_FLAG = 0x02;
|
const int PQISSL_REMOTE_FLAG = 0x02;
|
||||||
const int PQISSL_UDP_FLAG = 0x02;
|
const int PQISSL_UDP_FLAG = 0x02;
|
||||||
@ -629,40 +630,45 @@ int pqissl::Initiate_Connection()
|
|||||||
int size = sizeof(int);
|
int size = sizeof(int);
|
||||||
|
|
||||||
err = getsockopt(osock, SOL_SOCKET, SO_RCVBUF, (char *)&sockbufsize, &size);
|
err = getsockopt(osock, SOL_SOCKET, SO_RCVBUF, (char *)&sockbufsize, &size);
|
||||||
|
#ifdef PQISSL_DEBUG
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
std::cerr << "pqissl::Initiate_Connection: Current TCP receive buffer size " << sockbufsize << std::endl;
|
std::cerr << "pqissl::Initiate_Connection: Current TCP receive buffer size " << sockbufsize << std::endl;
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "pqissl::Initiate_Connection: Error getting TCP receive buffer size. Error " << err << std::endl;
|
std::cerr << "pqissl::Initiate_Connection: Error getting TCP receive buffer size. Error " << err << std::endl;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
sockbufsize = 0;
|
sockbufsize = 0;
|
||||||
|
|
||||||
err = getsockopt(osock, SOL_SOCKET, SO_SNDBUF, (char *)&sockbufsize, &size);
|
err = getsockopt(osock, SOL_SOCKET, SO_SNDBUF, (char *)&sockbufsize, &size);
|
||||||
|
#ifdef PQISSL_DEBUG
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
std::cerr << "pqissl::Initiate_Connection: Current TCP send buffer size " << sockbufsize << std::endl;
|
std::cerr << "pqissl::Initiate_Connection: Current TCP send buffer size " << sockbufsize << std::endl;
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "pqissl::Initiate_Connection: Error getting TCP send buffer size. Error " << err << std::endl;
|
std::cerr << "pqissl::Initiate_Connection: Error getting TCP send buffer size. Error " << err << std::endl;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
sockbufsize = WINDOWS_TCP_BUFFER_SIZE;
|
sockbufsize = WINDOWS_TCP_BUFFER_SIZE;
|
||||||
|
|
||||||
err = setsockopt(osock, SOL_SOCKET, SO_RCVBUF, (char *)&sockbufsize, sizeof(sockbufsize));
|
err = setsockopt(osock, SOL_SOCKET, SO_RCVBUF, (char *)&sockbufsize, sizeof(sockbufsize));
|
||||||
|
#ifdef PQISSL_DEBUG
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
std::cerr << "pqissl::Initiate_Connection: TCP receive buffer size set to " << sockbufsize << std::endl;
|
std::cerr << "pqissl::Initiate_Connection: TCP receive buffer size set to " << sockbufsize << std::endl;
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "pqissl::Initiate_Connection: Error setting TCP receive buffer size. Error " << err << std::endl;
|
std::cerr << "pqissl::Initiate_Connection: Error setting TCP receive buffer size. Error " << err << std::endl;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
err = setsockopt(osock, SOL_SOCKET, SO_SNDBUF, (char *)&sockbufsize, sizeof(sockbufsize));
|
err = setsockopt(osock, SOL_SOCKET, SO_SNDBUF, (char *)&sockbufsize, sizeof(sockbufsize));
|
||||||
|
#ifdef PQISSL_DEBUG
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
std::cerr << "pqissl::Initiate_Connection: TCP send buffer size set to " << sockbufsize << std::endl;
|
std::cerr << "pqissl::Initiate_Connection: TCP send buffer size set to " << sockbufsize << std::endl;
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "pqissl::Initiate_Connection: Error setting TCP send buffer size. Error " << err << std::endl;
|
std::cerr << "pqissl::Initiate_Connection: Error setting TCP send buffer size. Error " << err << std::endl;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif // WINDOWS_SYS
|
||||||
|
|
||||||
mTimeoutTS = time(NULL) + mConnectTimeout;
|
mTimeoutTS = time(NULL) + mConnectTimeout;
|
||||||
//std::cerr << "Setting Connect Timeout " << mConnectTimeout << " Seconds into Future " << std::endl;
|
//std::cerr << "Setting Connect Timeout " << mConnectTimeout << " Seconds into Future " << std::endl;
|
||||||
@ -1381,7 +1387,7 @@ int pqissl::senddata(void *data, int len)
|
|||||||
{
|
{
|
||||||
int tmppktlen ;
|
int tmppktlen ;
|
||||||
|
|
||||||
#ifdef DEBUG_PQISSL
|
#ifdef PQISSL_DEBUG
|
||||||
std::cout << "Sending data thread=" << pthread_self() << ", ssl=" << (void*)this << ", size=" << len << std::endl ;
|
std::cout << "Sending data thread=" << pthread_self() << ", ssl=" << (void*)this << ", size=" << len << std::endl ;
|
||||||
#endif
|
#endif
|
||||||
tmppktlen = SSL_write(ssl_connection, data, len) ;
|
tmppktlen = SSL_write(ssl_connection, data, len) ;
|
||||||
@ -1401,7 +1407,7 @@ int pqissl::senddata(void *data, int len)
|
|||||||
{
|
{
|
||||||
out << "SSL_write() SSL_ERROR_SYSCALL";
|
out << "SSL_write() SSL_ERROR_SYSCALL";
|
||||||
out << std::endl;
|
out << std::endl;
|
||||||
out << "Socket Closed Abruptly.... Resetting PQIssl";
|
out << "Socket Closed Abruptly.... Resetting PQIssl";
|
||||||
out << std::endl;
|
out << std::endl;
|
||||||
std::cerr << out.str() ;
|
std::cerr << out.str() ;
|
||||||
rslog(RSL_ALERT, pqisslzone, out.str());
|
rslog(RSL_ALERT, pqisslzone, out.str());
|
||||||
@ -1464,7 +1470,7 @@ int pqissl::senddata(void *data, int len)
|
|||||||
|
|
||||||
int pqissl::readdata(void *data, int len)
|
int pqissl::readdata(void *data, int len)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_PQISSL
|
#ifdef PQISSL_DEBUG
|
||||||
std::cout << "Reading data thread=" << pthread_self() << ", ssl=" << (void*)this << std::endl ;
|
std::cout << "Reading data thread=" << pthread_self() << ", ssl=" << (void*)this << std::endl ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1475,11 +1481,11 @@ int pqissl::readdata(void *data, int len)
|
|||||||
{
|
{
|
||||||
int tmppktlen ;
|
int tmppktlen ;
|
||||||
|
|
||||||
#ifdef DEBUG_PQISSL
|
#ifdef PQISSL_DEBUG
|
||||||
std::cerr << "calling SSL_read. len=" << len << ", total_len=" << total_len << std::endl ;
|
std::cerr << "calling SSL_read. len=" << len << ", total_len=" << total_len << std::endl ;
|
||||||
#endif
|
#endif
|
||||||
tmppktlen = SSL_read(ssl_connection, (void*)( &(((uint8_t*)data)[total_len])), len-total_len) ;
|
tmppktlen = SSL_read(ssl_connection, (void*)( &(((uint8_t*)data)[total_len])), len-total_len) ;
|
||||||
#ifdef DEBUG_PQISSL
|
#ifdef PQISSL_DEBUG
|
||||||
std::cerr << "have read " << tmppktlen << " bytes" << std::endl ;
|
std::cerr << "have read " << tmppktlen << " bytes" << std::endl ;
|
||||||
std::cerr << "data[0] = "
|
std::cerr << "data[0] = "
|
||||||
<< (int)((uint8_t*)data)[total_len+0] << " "
|
<< (int)((uint8_t*)data)[total_len+0] << " "
|
||||||
@ -1606,7 +1612,7 @@ int pqissl::readdata(void *data, int len)
|
|||||||
total_len+=tmppktlen ;
|
total_len+=tmppktlen ;
|
||||||
} while(total_len < len) ;
|
} while(total_len < len) ;
|
||||||
|
|
||||||
#ifdef DEBUG_PQISSL
|
#ifdef PQISSL_DEBUG
|
||||||
std::cerr << "pqissl: have read data of length " << total_len << ", expected is " << len << std::endl ;
|
std::cerr << "pqissl: have read data of length " << total_len << ", expected is " << len << std::endl ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user