catalinux / Conn (public) (License: LGPLv2) (since 2016-03-01) (hash sha1)
Net library for easy building ipv4/ipv6 network daemons/clients
List of commits:
Subject Hash Author Date (UTC)
Mostly debug and cosmetic f9de48ed05221de560fcc87ffb4935bceda0fe36 Catalin(ux) M. BOIE 2024-03-29 06:28:06
If an error occured in the close phase, do not try to send anymore 20e4e5948c9dacb251a784f031bd7bd7a0db9fcf Catalin(ux) M. BOIE 2022-12-23 10:07:31
Cosmetic 8099e0095edcd1ae33a85ff091165bea7bae2555 Catalin(ux) M. BOIE 2022-10-22 08:22:42
Removed Changelog from .spec fb6a7fb9729da0d2bc5fae4fd5f0dd5636223754 Catalin(ux) M. BOIE 2022-10-21 16:36:27
Websocket changes + cosmetic 7438b1adf4a62d1fc5625224318a4b8922abf8c4 Catalin(ux) M. BOIE 2022-10-21 16:21:59
Fix a gcc warning a85c2219114d8b23a40901364db06580d6a40fce Catalin(ux) M. BOIE 2018-08-18 04:40:25
Notes goes under the title; title is nicer 8acce1da5bc4866b6a4bf7fb2af53750e6749a9a Catalin(ux) M. BOIE 2018-08-18 04:40:08
CSS fixes for showing source 1b96ffce7e3744972be0be246cd33d0b107a8553 Catalin(ux) M. BOIE 2018-08-17 03:42:45
Bump version to 1.0.39 9b34e52482191606aa7f92a781d5b5e33a5543c8 Catalin(ux) M. BOIE 2018-05-20 19:14:39
CSS fixes for wsdemo 7fed15a4b4a7ebc154f68a99eb413fea4726ec26 Catalin(ux) M. BOIE 2018-05-20 19:13:44
More compiler flags for security d33f9fdb57826353c755b86493c72993635b1053 Catalin(ux) M. BOIE 2018-05-20 18:56:42
grid1 is working now 0370e6808f8b89fb9ae43fc139195e76247ad6c5 Catalin(ux) M. BOIE 2018-05-12 15:31:00
Added pie2 demo (svg) e8df18b15deafdd0a810a09a251593ecd5fc608f Catalin(ux) M. BOIE 2018-04-17 21:46:02
wsdemo: added Source button 010d08897f99736b9a3f5440af71c2dc40544e68 Catalin(ux) M. BOIE 2018-04-17 17:54:53
More tweaks to wsdemo 56173807662daf36b36907d98bde751749c91075 Catalin(ux) M. BOIE 2018-04-16 18:08:18
Added a callback for worker start 32a05f401d5258f06af9db15a00a615859961cc2 Catalin(ux) M. BOIE 2018-04-16 18:07:55
wsdemo improvements 3eb3efd007fc9240ea39fabcdb4729d1367ebad2 Catalin(ux) M. BOIE 2018-04-13 22:47:24
wsdemo added 2baae01f2409496f990b6d673013b66286f0a5af Catalin(ux) M. BOIE 2018-04-02 21:41:40
Various small stuff 0c551268be734dd68a59426315abfc6ef776c60a Catalin(ux) M. BOIE 2018-04-02 21:40:49
More debugging for websocket parsing 66ccde632b280f1aa450610e6b671464b7e56451 Catalin(ux) M. BOIE 2018-04-02 21:39:23
Commit f9de48ed05221de560fcc87ffb4935bceda0fe36 - Mostly debug and cosmetic
Author: Catalin(ux) M. BOIE
Author date (UTC): 2024-03-29 06:28
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2024-03-29 06:28
Parent(s): 20e4e5948c9dacb251a784f031bd7bd7a0db9fcf
Signing key:
Tree: 436f2497a18a0175569c55eb1d2d8a513ec2978f
File Lines added Lines deleted
Conn.c 31 13
Conn.h 2 0
Conn_web.c 3 1
Makefile.in 1 1
duilder.conf 1 1
File Conn.c changed (mode: 100644) (index c978684..7de3180)
... ... static int Conn_recv_fd(int comm_fd)
403 403 #endif #endif
404 404
405 405 #if 1 #if 1
406 __cold void Log_simple(const unsigned short level, char *msg)
407 {
408 char line[4096];
409
410 if (likely(level > Conn_debug_level))
411 return;
412
413 snprintf(line, sizeof(line), "%ld.%03ld %s %s",
414 Conn_now.tv_sec, Conn_now.tv_usec / 1000, log_info, msg);
415
416 write(Conn_log_fd, line, strlen(line));
417 }
418
406 419 __cold void Log(const unsigned short level, char *format, ...) __cold void Log(const unsigned short level, char *format, ...)
407 420 { {
408 421 va_list ap; va_list ap;
409 size_t len;
410 422 char line[4096]; char line[4096];
411 423
412 424 if (likely(level > Conn_debug_level)) if (likely(level > Conn_debug_level))
413 425 return; return;
414 426
415 snprintf(line, sizeof(line), "%ld.%06ld %s ",
416 Conn_now.tv_sec, Conn_now.tv_usec, log_info);
417 len = strlen(line);
418
419 427 va_start(ap, format); va_start(ap, format);
420 vsnprintf(line + len, sizeof(line) - len, format, ap);
428 vsnprintf(line, sizeof(line), format, ap);
421 429 va_end(ap); va_end(ap);
422 430
423 write(Conn_log_fd, line, strlen(line));
431 Log_simple(level, line);
424 432 } }
433
425 434 #else #else
426 inline void Log(const unsigned short level, char *format, ...)
435 void Log_simple(const unsigned short level, char *msg)
436 {
437 }
438
439 void Log(const unsigned short level, char *format, ...)
440 {
441 }
442
443 void vLog(const unsigned short level, va_list ap)
427 444 { {
428 return;
429 445 } }
430 446 #endif #endif
431 447
 
... ... __hot static void Conn_free_intern(struct Conn *C)
741 757 C->id, __func__, C->fd, Conn_state(C), Conn_errno(C)); C->id, __func__, C->fd, Conn_state(C), Conn_errno(C));
742 758 } }
743 759
744 if (C->error_state != CONN_ERROR_USERREQ)
760 if (C->error_state != CONN_ERROR_USERREQ) {
745 761 Conn_error_raise(C, 0); Conn_error_raise(C, 0);
762 Log(10, "\tAfter error_raise fd=%d\n", C->fd);
763 }
746 764
747 765 if ((C->state == CONN_STATE_OPEN) if ((C->state == CONN_STATE_OPEN)
748 766 || (C->state == CONN_STATE_LISTEN) || (C->state == CONN_STATE_LISTEN)
 
... ... void Conn_stop(void)
891 909 /* /*
892 910 * Returns the fd associated with C * Returns the fd associated with C
893 911 */ */
894 static int Conn_get_fd(const struct Conn *C)
912 int Conn_get_fd(const struct Conn *C)
895 913 { {
896 914 return C->fd; return C->fd;
897 915 } }
 
... ... static inline int Conn_dispatch_events(struct Conn_wpool_worker *w,
2502 2520 if (unlikely(Conn_debug_level > 8)) { if (unlikely(Conn_debug_level > 8)) {
2503 2521 char sevents[16]; char sevents[16];
2504 2522
2505 Log(0, "\tProcessing %d event(s):\n", events);
2523 Log(10, "\tProcessing %d event(s):\n", events);
2506 2524 for (i = 0; i < events; i++) { for (i = 0; i < events; i++) {
2507 2525 C = e[i].data.ptr; C = e[i].data.ptr;
2508 2526 Conn_poll_status(e[i].events, sevents); Conn_poll_status(e[i].events, sevents);
2509 Log(0, "\tptr=%p ### ev i=%d %s\n", C, i, sevents);
2527 Log(11, "\tptr=%p ### ev i=%d %s\n", C, i, sevents);
2510 2528 } }
2511 2529 } }
2512 2530 for (i = 0; i < events; i++) { for (i = 0; i < events; i++) {
File Conn.h changed (mode: 100644) (index f3e90d8..480f842)
... ... enum CONN_CB {
41 41 }; };
42 42
43 43 /* misc */ /* misc */
44 void Log_simple(const unsigned short level, char *msg);
44 45 void Log(const unsigned short level, char *format, ...); void Log(const unsigned short level, char *format, ...);
45 46 char *Conn_dump(const void *buf_src0, const size_t len_src); char *Conn_dump(const void *buf_src0, const size_t len_src);
46 47 char *Conn_dumphex(const void *buf_src0, const size_t len_src); char *Conn_dumphex(const void *buf_src0, const size_t len_src);
 
... ... void Conn_eatall(struct Conn *C);
102 103 void Conn_send_done(struct Conn *C); void Conn_send_done(struct Conn *C);
103 104 void Conn_close(struct Conn *C); void Conn_close(struct Conn *C);
104 105 void Conn_stop(void); void Conn_stop(void);
106 int Conn_get_fd(const struct Conn *C);
105 107 void Conn_set(struct Conn *C, const unsigned int var, void Conn_set(struct Conn *C, const unsigned int var,
106 108 const int val); const int val);
107 109 char *Conn_addr_local(struct Conn *C); char *Conn_addr_local(struct Conn *C);
File Conn_web.c changed (mode: 100644) (index e9e694f..d7f5dfa)
... ... int Conn_web_ws_parse(struct Conn_web_ws *w, struct Conn *C)
632 632 if (unlikely(w->opcode != 0x1)) { if (unlikely(w->opcode != 0x1)) {
633 633 Conn_set_error("opcode is not 'text' (%hhu); w->len=%u", Conn_set_error("opcode is not 'text' (%hhu); w->len=%u",
634 634 w->opcode, w->len); w->opcode, w->len);
635 Conn_dump(buf, w->len);
635 char *dump = Conn_dump(buf, w->len);
636 Log(20, " buf: %s\n", dump);
637 free(dump);
636 638 return -1; return -1;
637 639 } }
638 640
File Makefile.in changed (mode: 100644) (index aa9a4eb..fb7abee)
... ... export INCS += -I.
5 5 export LIBS += -lgnutls #-lpthread export LIBS += -lgnutls #-lpthread
6 6 export OBJS += Conn.o Conn_web.o export OBJS += Conn.o Conn_web.o
7 7
8 export CFLAGS := -Wall -Wextra -pipe -g $(CC_SWITCHES) $(CFLAGS) -D _FORTIFY_SOURCES=2
8 export CFLAGS := -Wall -Wextra -pipe -g $(CC_SWITCHES) $(CFLAGS) -D _FORTIFY_SOURCES=3
9 9
10 10
11 11 .PHONY: all .PHONY: all
File duilder.conf changed (mode: 100644) (index e672a35..54b2bae)
1 1 PRJ="Conn" PRJ="Conn"
2 VER="1.0.40"
2 VER="1.0.41"
3 3 REV="1" REV="1"
4 4 EXCLUDE=".exclude" EXCLUDE=".exclude"
5 5 EXPORT_PATH="/data/www/umbrella/kernel/us/Conn" EXPORT_PATH="/data/www/umbrella/kernel/us/Conn"
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/catalinux/Conn

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/catalinux/Conn

Clone this repository using git:
git clone git://git.rocketgit.com/user/catalinux/Conn

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main