mirror of
https://github.com/wangyu-/udp2raw.git
synced 2025-09-16 04:04:27 +08:00
Compare commits
7 Commits
20230206.0
...
revert-455
Author | SHA1 | Date | |
---|---|---|---|
|
f3f528e866 | ||
|
ec6fad552b | ||
|
87b878a09e | ||
|
e66eddd1d5 | ||
|
d12e540830 | ||
|
e7eecc8ef2 | ||
|
82ba4f7d1b |
@@ -1,4 +1,7 @@
|
|||||||
#note: experimental
|
#note: experimental
|
||||||
|
# currently only used for generating `compile_commands.json` for clangd.
|
||||||
|
# to build this project, it's suggested to use `makefile` instead
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.7)
|
cmake_minimum_required(VERSION 3.7)
|
||||||
project(udp2raw)
|
project(udp2raw)
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
@@ -1 +1 @@
|
|||||||
English Only (except for bug reporting).
|
English Only.
|
||||||
|
@@ -1127,8 +1127,8 @@ void print_binary_chars(const char *a, int len) {
|
|||||||
u32_t djb2(unsigned char *str, int len) {
|
u32_t djb2(unsigned char *str, int len) {
|
||||||
u32_t hash = 5381;
|
u32_t hash = 5381;
|
||||||
int c;
|
int c;
|
||||||
int i = 0;
|
for (int i=0; i<len ;i++) {
|
||||||
while (c = *str++, i++ != len) {
|
c = *(str++);
|
||||||
hash = ((hash << 5) + hash) ^ c; /* (hash * 33) ^ c */
|
hash = ((hash << 5) + hash) ^ c; /* (hash * 33) ^ c */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1139,8 +1139,8 @@ u32_t djb2(unsigned char *str, int len) {
|
|||||||
u32_t sdbm(unsigned char *str, int len) {
|
u32_t sdbm(unsigned char *str, int len) {
|
||||||
u32_t hash = 0;
|
u32_t hash = 0;
|
||||||
int c;
|
int c;
|
||||||
int i = 0;
|
for (int i=0; i<len ;i++) {
|
||||||
while (c = *str++, i++ != len) {
|
c = *(str++);
|
||||||
hash = c + (hash << 6) + (hash << 16) - hash;
|
hash = c + (hash << 6) + (hash << 16) - hash;
|
||||||
}
|
}
|
||||||
// hash=htonl(hash);
|
// hash=htonl(hash);
|
||||||
|
8
main.cpp
8
main.cpp
@@ -40,19 +40,19 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
pre_process_arg(argc, argv);
|
pre_process_arg(argc, argv);
|
||||||
|
|
||||||
|
ev_signal signal_watcher_sigpipe;
|
||||||
|
ev_signal signal_watcher_sigterm;
|
||||||
|
ev_signal signal_watcher_sigint;
|
||||||
|
|
||||||
if (program_mode == client_mode) {
|
if (program_mode == client_mode) {
|
||||||
struct ev_loop *loop = ev_default_loop(0);
|
struct ev_loop *loop = ev_default_loop(0);
|
||||||
#if !defined(__MINGW32__)
|
#if !defined(__MINGW32__)
|
||||||
ev_signal signal_watcher_sigpipe;
|
|
||||||
ev_signal_init(&signal_watcher_sigpipe, sigpipe_cb, SIGPIPE);
|
ev_signal_init(&signal_watcher_sigpipe, sigpipe_cb, SIGPIPE);
|
||||||
ev_signal_start(loop, &signal_watcher_sigpipe);
|
ev_signal_start(loop, &signal_watcher_sigpipe);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ev_signal signal_watcher_sigterm;
|
|
||||||
ev_signal_init(&signal_watcher_sigterm, sigterm_cb, SIGTERM);
|
ev_signal_init(&signal_watcher_sigterm, sigterm_cb, SIGTERM);
|
||||||
ev_signal_start(loop, &signal_watcher_sigterm);
|
ev_signal_start(loop, &signal_watcher_sigterm);
|
||||||
|
|
||||||
ev_signal signal_watcher_sigint;
|
|
||||||
ev_signal_init(&signal_watcher_sigint, sigint_cb, SIGINT);
|
ev_signal_init(&signal_watcher_sigint, sigint_cb, SIGINT);
|
||||||
ev_signal_start(loop, &signal_watcher_sigint);
|
ev_signal_start(loop, &signal_watcher_sigint);
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user