updated picoTCP to 1.4.0, lowered build optimization levels to -O2, improved selftest
This commit is contained in:
@@ -75,7 +75,17 @@
|
||||
// a short period of time by default as a precaution.
|
||||
|
||||
#define ZT_SOCK_BEHAVIOR_LINGER true
|
||||
#define ZT_SOCK_BEHAVIOR_LINGER_TIME 1 // s
|
||||
#define ZT_SOCK_BEHAVIOR_LINGER_TIME 3 // s
|
||||
|
||||
// After closing a pico_socket, other threads might still try to use the
|
||||
// Connection object for remaining data I/O, as a safety measure we will wait to
|
||||
// delete this Connection object until the socket has been closed for some arbitrary
|
||||
// amount of time and it is safe to assume any clients interacting with this
|
||||
// socket have read some sort of error code from the API.
|
||||
#define ZT_CONNECTION_DELETE_WAIT_TIME 30 // s
|
||||
|
||||
// Interval for performing cleanup tasks on Tap/Stack objects
|
||||
#define ZT_HOUSEKEEPING_INTERVAL 10 // s
|
||||
|
||||
/****************************************************************************/
|
||||
/* Socket API Signatures */
|
||||
@@ -384,142 +394,7 @@ int pico_ntimers();
|
||||
*/
|
||||
void *zts_start_service(void *thread_id);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Debug */
|
||||
/****************************************************************************/
|
||||
|
||||
#include <pthread.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define ZT_DEBUG_LEVEL 5 // Set this to adjust what you'd like to see in the debug traces
|
||||
|
||||
#define ZT_MSG_ERROR 1 // Errors
|
||||
#define ZT_MSG_TRANSFER 2 // RX/TX specific statements
|
||||
#define ZT_MSG_INFO 3 // Information which is generally useful to any developer
|
||||
#define ZT_MSG_EXTRA 4 // If nothing in your world makes sense
|
||||
#define ZT_MSG_FLOW 5 // High-level flow messages
|
||||
#define ZT_FILENAMES true
|
||||
#define ZT_COLOR true
|
||||
|
||||
// Debug output colors
|
||||
#if defined(__APPLE__)
|
||||
#include "TargetConditionals.h"
|
||||
#endif
|
||||
#if defined(ZT_COLOR) && !defined(__ANDROID__) && !defined(TARGET_OS_IPHONE) && !defined(TARGET_IPHONE_SIMULATOR) && !defined(__APP_FRAMEWORK__)
|
||||
#define ZT_RED "\x1B[31m"
|
||||
#define ZT_GRN "\x1B[32m"
|
||||
#define ZT_YEL "\x1B[33m"
|
||||
#define ZT_BLU "\x1B[34m"
|
||||
#define ZT_MAG "\x1B[35m"
|
||||
#define ZT_CYN "\x1B[36m"
|
||||
#define ZT_WHT "\x1B[37m"
|
||||
#define ZT_RESET "\x1B[0m"
|
||||
#else
|
||||
#define ZT_RED
|
||||
#define ZT_GRN
|
||||
#define ZT_YEL
|
||||
#define ZT_BLU
|
||||
#define ZT_MAG
|
||||
#define ZT_CYN
|
||||
#define ZT_WHT
|
||||
#define ZT_RESET
|
||||
#endif
|
||||
|
||||
// filenames
|
||||
#if ZT_FILENAMES
|
||||
#if ZT_FULL_FILENAME_PATH
|
||||
#define ZT_FILENAME __FILE__ // show the entire mess
|
||||
#else
|
||||
#define ZT_FILENAME (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) // short
|
||||
#endif
|
||||
#else
|
||||
#define ZT_FILENAME // omit filename
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#define ZT_THREAD_ID 0 // (long)getpid()
|
||||
#elif __APPLE__
|
||||
#define ZT_THREAD_ID 0 // (long)syscall(SYS_thread_selfid)
|
||||
#endif
|
||||
|
||||
#if defined(__JNI_LIB__)
|
||||
#include <jni.h>
|
||||
#endif
|
||||
#if defined(__ANDROID__)
|
||||
#include <android/log.h>
|
||||
#define ZT_LOG_TAG "ZTSDK"
|
||||
#endif
|
||||
|
||||
#if ZT_DEBUG_LEVEL >= ZT_MSG_ERROR
|
||||
#define DEBUG_ERROR(fmt, args...) fprintf(stderr, ZT_RED "ZT_ERROR[%ld] : %16s:%4d:%25s: " fmt \
|
||||
"\n" ZT_RESET, ZT_THREAD_ID, ZT_FILENAME, __LINE__, __FUNCTION__, ##args)
|
||||
#else
|
||||
#define DEBUG_ERROR(fmt, args...)
|
||||
#endif
|
||||
|
||||
#if ZT_DEBUG_LEVEL >= ZT_MSG_INFO
|
||||
#if defined(__ANDROID__)
|
||||
#define DEBUG_INFO(fmt, args...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, ZT_LOG_TAG, \
|
||||
"ZT_INFO : %16s:%4d:%20s: " fmt "\n", ZT_FILENAME, __LINE__, __FUNCTION__, ##args))
|
||||
#define DEBUG_BLANK(fmt, args...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, ZT_LOG_TAG, \
|
||||
"ZT_INFO : %16s:%4d:" fmt "\n", ZT_FILENAME, __LINE__, __FUNCTION__, ##args))
|
||||
#define DEBUG_ATTN(fmt, args...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, ZT_LOG_TAG, \
|
||||
"ZT_INFO : %16s:%4d:%25s: " fmt "\n", ZT_FILENAME, __LINE__, __FUNCTION__, ##args))
|
||||
#define DEBUG_STACK(fmt, args...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, ZT_LOG_TAG, \
|
||||
"ZT_STACK: %16s:%4d:%25s: " fmt "\n", ZT_FILENAME, __LINE__, __FUNCTION__, ##args))
|
||||
#else
|
||||
#define DEBUG_INFO(fmt, args...) fprintf(stderr, \
|
||||
"ZT_INFO [%ld] : %16s:%4d:%25s: " fmt "\n", ZT_THREAD_ID, ZT_FILENAME, __LINE__, __FUNCTION__, ##args)
|
||||
#define DEBUG_ATTN(fmt, args...) fprintf(stderr, ZT_CYN \
|
||||
"ZT_ATTN [%ld] : %16s:%4d:%25s: " fmt "\n" ZT_RESET, ZT_THREAD_ID, ZT_FILENAME, __LINE__, __FUNCTION__, ##args)
|
||||
#define DEBUG_STACK(fmt, args...) fprintf(stderr, ZT_YEL \
|
||||
"ZT_STACK[%ld] : %16s:%4d:%25s: " fmt "\n" ZT_RESET, ZT_THREAD_ID, ZT_FILENAME, __LINE__, __FUNCTION__, ##args)
|
||||
#define DEBUG_BLANK(fmt, args...) fprintf(stderr, \
|
||||
"ZT_INFO [%ld] : %16s:%4d:" fmt "\n", ZT_THREAD_ID, ZT_FILENAME, __LINE__, ##args)
|
||||
#endif
|
||||
#else
|
||||
#define DEBUG_INFO(fmt, args...)
|
||||
#define DEBUG_BLANK(fmt, args...)
|
||||
#define DEBUG_ATTN(fmt, args...)
|
||||
#define DEBUG_STACK(fmt, args...)
|
||||
#endif
|
||||
|
||||
#if ZT_DEBUG_LEVEL >= ZT_MSG_TRANSFER
|
||||
#if defined(__ANDROID__)
|
||||
#define DEBUG_TRANS(fmt, args...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, ZT_LOG_TAG, \
|
||||
"ZT_TRANS : %16s:%4d:%25s: " fmt "\n", ZT_FILENAME, __LINE__, __FUNCTION__, ##args))
|
||||
#else
|
||||
#define DEBUG_TRANS(fmt, args...) fprintf(stderr, ZT_GRN "ZT_TRANS[%ld] : %16s:%4d:%25s: " fmt \
|
||||
"\n" ZT_RESET, ZT_THREAD_ID, ZT_FILENAME, __LINE__, __FUNCTION__, ##args)
|
||||
#endif
|
||||
#else
|
||||
#define DEBUG_TRANS(fmt, args...)
|
||||
#endif
|
||||
|
||||
#if ZT_DEBUG_LEVEL >= ZT_MSG_EXTRA
|
||||
#if defined(__ANDROID__)
|
||||
#define DEBUG_EXTRA(fmt, args...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, ZT_LOG_TAG, \
|
||||
"ZT_EXTRA : %16s:%4d:%25s: " fmt "\n", ZT_FILENAME, __LINE__, __FUNCTION__, ##args))
|
||||
#else
|
||||
#define DEBUG_EXTRA(fmt, args...) fprintf(stderr, \
|
||||
"ZT_EXTRA[%ld] : %16s:%4d:%25s: " fmt "\n", ZT_THREAD_ID, ZT_FILENAME, __LINE__, __FUNCTION__, ##args)
|
||||
#endif
|
||||
#else
|
||||
#define DEBUG_EXTRA(fmt, args...)
|
||||
#endif
|
||||
|
||||
#if ZT_DEBUG_LEVEL >= ZT_MSG_FLOW
|
||||
#if defined(__ANDROID__)
|
||||
#define DEBUG_FLOW(fmt, args...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, ZT_LOG_TAG, \
|
||||
"ZT_FLOW : %16s:%4d:%25s: " fmt "\n", ZT_FILENAME, __LINE__, __FUNCTION__, ##args))
|
||||
#else
|
||||
#define DEBUG_FLOW(fmt, args...) fprintf(stderr, "ZT_FLOW [%ld] : %16s:%4d:%25s: " fmt "\n", \
|
||||
ZT_THREAD_ID, ZT_FILENAME, __LINE__, __FUNCTION__, ##args)
|
||||
#endif
|
||||
#else
|
||||
#define DEBUG_FLOW(fmt, args...)
|
||||
#endif
|
||||
#include "Debug.hpp"
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
Reference in New Issue
Block a user