Skip to content

Commit

Permalink
SSE implementation improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanocasazza committed Jan 6, 2018
1 parent f824255 commit 78b2844
Show file tree
Hide file tree
Showing 47 changed files with 1,126 additions and 5,825 deletions.
1,085 changes: 74 additions & 1,011 deletions CODE_OF_CONDUCT.md

Large diffs are not rendered by default.

970 changes: 5 additions & 965 deletions CONTRIBUTING.md

Large diffs are not rendered by default.

8 changes: 2 additions & 6 deletions configure
Expand Up @@ -1805,7 +1805,7 @@ Optional Features:
--enable-GSDS enable GDB Stack Dump Support [default=no]
--enable-HCRS enable Cache Request Support [default=no]
--enable-HPRS enable Homogeneous Pipeline Request Support [default=no]
--enable-SSE enable Server-Sent Events Support [default=yes]
--enable-SSE enable Server-Sent Events Support [default=no]
--enable-http2 enable HTTP/2 support [default=no]
--enable-check-time enable server check time between request for parallelization [default=no]
--enable-classic enable server classic model support [default=no]
Expand Down Expand Up @@ -28336,11 +28336,7 @@ if test "${enable_SSE+set}" = set; then :
fi

if test -z "$enable_SSE"; then
if test "$USP_FLAGS" = "-DAS_cpoll_cppsp_DO"; then
enable_SSE="no"
else
enable_SSE="yes"
fi
enable_SSE="no"
fi
if test "$enable_SSE" = "yes"; then

Expand Down
89 changes: 38 additions & 51 deletions examples/IR/ir_web.cpp
Expand Up @@ -3,57 +3,44 @@
#include <ulib/net/server/usp_macro.h>

#include "ir_session.h"
#include <ulib/debug/crono.h>

#define IR_SESSION (*(IRDataSession*)UHTTP::data_session)

static IR* ir;
static Query* query;
static UCrono* crono;
static UString* footer;

static void usp_init_ir_web()
{
U_TRACE(5, "::usp_init_ir_web()")

U_INTERNAL_ASSERT_EQUALS(ir, U_NULLPTR)
U_INTERNAL_ASSERT_EQUALS(query, U_NULLPTR)
U_INTERNAL_ASSERT_EQUALS(crono, U_NULLPTR)
U_INTERNAL_ASSERT_EQUALS(footer, U_NULLPTR)

U_NEW(IR, ir, IR);
U_NEW(Query, query, Query);
U_NEW(UCrono, crono, UCrono);
U_NEW(UString, footer, UString(200U));

ir->loadFileConfig();

if (ir->openCDB(false) == false)
{
U_ERROR("usp_init() of servlet ir_web failed");
}

footer->snprintf(U_CONSTANT_TO_PARAM("ver. %.*s, with %u documents and %u words."), U_CONSTANT_TO_TRACE(ULIB_VERSION), cdb_names->size(), cdb_words->size());

U_NEW(IRDataSession, UHTTP::data_session, IRDataSession);

UHTTP::initSession();
}

static void usp_end_ir_web()
{
U_TRACE(5, "::usp_end_ir_web()")

U_INTERNAL_ASSERT_POINTER(ir)
U_INTERNAL_ASSERT_POINTER(query)
U_INTERNAL_ASSERT_POINTER(crono)
U_INTERNAL_ASSERT_POINTER(footer)

delete ir;
delete query;
delete crono;
delete footer;
}
#include <ulib/debug/crono.h>
#define IR_SESSION (*(IRDataSession*)UHTTP::data_session)
static IR* ir;
static Query* query;
static UCrono* crono;
static UString* footer;
static void usp_init_ir_web()
{
U_TRACE(5, "::usp_init_ir_web()")
U_INTERNAL_ASSERT_EQUALS(ir, U_NULLPTR)
U_INTERNAL_ASSERT_EQUALS(query, U_NULLPTR)
U_INTERNAL_ASSERT_EQUALS(crono, U_NULLPTR)
U_INTERNAL_ASSERT_EQUALS(footer, U_NULLPTR)
U_NEW(IR, ir, IR);
U_NEW(Query, query, Query);
U_NEW(UCrono, crono, UCrono);
U_NEW(UString, footer, UString(200U));
ir->loadFileConfig();
if (ir->openCDB(false) == false)
{
U_ERROR("usp_init() of servlet ir_web failed");
}
footer->snprintf(U_CONSTANT_TO_PARAM("ver. %.*s, with %u documents and %u words."), U_CONSTANT_TO_TRACE(ULIB_VERSION), cdb_names->size(), cdb_words->size());
U_NEW(IRDataSession, UHTTP::data_session, IRDataSession);
UHTTP::initSession();
}
static void usp_end_ir_web()
{
U_TRACE(5, "::usp_end_ir_web()")
U_INTERNAL_ASSERT_POINTER(ir)
U_INTERNAL_ASSERT_POINTER(query)
U_INTERNAL_ASSERT_POINTER(crono)
U_INTERNAL_ASSERT_POINTER(footer)
delete ir;
delete query;
delete crono;
delete footer;
}

extern "C" {
extern U_EXPORT void runDynamicPage_ir_web(int param);
Expand Down
7 changes: 3 additions & 4 deletions examples/WiAuth/wi_auth.cpp
Expand Up @@ -3,10 +3,9 @@
#include <ulib/net/server/usp_macro.h>

static void usp_end_wi_auth();
static void usp_init_wi_auth();
static void usp_sighup_wi_auth();

#include <ulib/examples/wi_auth_declaration.h>
static void usp_init_wi_auth();
static void usp_sighup_wi_auth();
#include <ulib/examples/wi_auth_declaration.h>

extern "C" {
extern U_EXPORT void runDynamicPage_wi_auth(int param);
Expand Down
19 changes: 14 additions & 5 deletions include/ulib/base/base.h
Expand Up @@ -93,19 +93,19 @@ U_DO_PRAGMA(message ("Sorry I was compiled without thread enabled so I cannot us
# endif
#endif
#if defined(U_THROTTLING_SUPPORT) && !defined(U_HTTP2_DISABLE)
# undef U_THROTTLING_SUPPORT
# undef U_THROTTLING_SUPPORT
U_DO_PRAGMA(message ("Sorry I was compiled with http2 enabled so I cannot support bandwidth throttling"))
#endif
#if defined(U_SERVER_CHECK_TIME_BETWEEN_REQUEST) && !defined(U_HTTP2_DISABLE)
# undef U_SERVER_CHECK_TIME_BETWEEN_REQUEST
# undef U_SERVER_CHECK_TIME_BETWEEN_REQUEST
U_DO_PRAGMA(message ("Sorry I was compiled with http2 enabled so I cannot support check time between request"))
#endif
#if !defined(U_CACHE_REQUEST_DISABLE) && !defined(U_HTTP2_DISABLE)
# define U_CACHE_REQUEST_DISABLE
# define U_CACHE_REQUEST_DISABLE
U_DO_PRAGMA(message ("Sorry I was compiled with http2 enabled so I cannot support cache request"))
#endif
#if defined(U_HTTP_INOTIFY_SUPPORT) && defined(U_SERVER_CAPTIVE_PORTAL)
# undef U_HTTP_INOTIFY_SUPPORT
# undef U_HTTP_INOTIFY_SUPPORT
U_DO_PRAGMA(message ("Sorry I was compiled with server captive portal mode enabled so I cannot support http inotify"))
#endif
#if defined(HAVE_CXX17) && defined(__GNUC__) && !defined(HAVE_CONFIG_H)
Expand All @@ -114,6 +114,15 @@ U_DO_PRAGMA(message ("ULib is configured with C++17 support, so you must use the
#if defined(USE_HARDWARE_CRC32) && defined(__GNUC__) && !defined(HAVE_CONFIG_H) /* The built-in functions __builtin_ia32_crc32 are available when -mcrc32 is used */
U_DO_PRAGMA(message ("ULib is configured with crc32 intrinsics support, so you must use the -mcrc32 g++ option for compilation"))
#endif
#ifdef U_SSE_ENABLE // SERVER SENT EVENTS (SSE)
# ifndef U_LINUX
# undef U_SSE_ENABLE
U_DO_PRAGMA(message ("Sorry I was not compiled on Linux so I cannot use SSE"))
# elif !defined(ENABLE_THREAD)
# undef U_SSE_ENABLE
U_DO_PRAGMA(message ("Sorry I was compiled without thread enabled so I cannot use SSE"))
# endif
#endif

#include <stddef.h>
#include <stdarg.h>
Expand Down Expand Up @@ -247,7 +256,7 @@ extern U_EXPORT uint32_t u_buffer_len; /* assert that u_buffer is busy if u_buff

/* Startup */

extern U_EXPORT pid_t u_pid;
extern U_EXPORT pid_t u_pid;
extern U_EXPORT char u_pid_str[10];
extern U_EXPORT uint32_t u_pid_str_len;
extern U_EXPORT uint32_t u_progname_len;
Expand Down
2 changes: 1 addition & 1 deletion include/ulib/examples/wi_auth_declaration.h
Expand Up @@ -5711,7 +5711,7 @@ loop: (void) nodog_rec->sendRequestToNodog(U_CONSTANT_TO_PARAM("check"), 0);
{
db_nodog->callForAllEntryWithVector(WiAuthNodog::checkAccessPoint);

if ((U_SRV_CNT_USR4++ % 10) == 0) resync();
if ((U_SRV_CNT_WIAUTH++ % 10) == 0) resync();
}

USSIPlugIn::setAlternativeResponse();
Expand Down
12 changes: 4 additions & 8 deletions include/ulib/file.h
Expand Up @@ -40,13 +40,9 @@

// File-permission-bit symbols

#define U_PERM__rw_r__r__ 0644
#define U_PERM__r________ 0400
#define U_PERM__r__r__r__ 0444
#define U_PERM__r_xr_xr_x 0555

#define PERM_FILE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH) // rw_rw_r__
#define PERM_DIRECTORY S_IRWXU // rwx
#define PERM_FILE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH) // rw_rw_r__
#define PERM_FIFO (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) // rw_rw_rw_
#define PERM_DIRECTORY S_IRWXU // rwx

// NB: the UString pathname maybe not writeable so path_relativ[path_relativ_len] maybe != '\0' (not null-terminate)...

Expand Down Expand Up @@ -980,7 +976,7 @@ class U_EXPORT UFile : public stat {

// make a FIFO special file (a named pipe)

static bool mkfifo(const char* _pathname, mode_t mode = S_IRUSR | S_IWUSR)
static bool mkfifo(const char* _pathname, mode_t mode = PERM_FIFO)
{
U_TRACE(1, "UFile::mkfifo(%S,%d)", _pathname, mode)

Expand Down

0 comments on commit 78b2844

Please sign in to comment.