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)
First round of memory status. 9e267dc05ec2c0b1e50288a6d9a5db5d3677e82e Catalin(ux) M. BOIE 2010-02-04 23:46:48
Do not overwrite Conn_error in Conn_free_intern. 380c378dd92e7a797f0dfec99bed7ce77034933c Catalin(ux) M. BOIE 2010-02-04 23:31:50
No need to remove fd from epoll just before closing it. bf7e91a441314a37f5f8a2430645c913b953499f Catalin(ux) M. BOIE 2010-02-04 23:17:05
Log status at the end for xbind example. 2caa2d8a3dc509e91235fd23c396061931ae1ef8 Catalin(ux) M. BOIE 2010-02-04 23:11:39
Log also fd in Conn_free_intern. 2e12c2ed0b4c39341ec3da3c6fc52d32f4a351eb Catalin(ux) M. BOIE 2010-02-04 23:11:09
In shutdown, close the file descriptors. 8bf16a0b5413d8f99cb466b52efcbd12318e958d Catalin(ux) M. BOIE 2010-01-27 18:51:36
Added xbind example. 1cdf8e8fd7ba9049eafef8f136d6b4e5e870b0ff Catalin(ux) M. BOIE 2009-12-30 22:37:01
TODO in/out. b0d7ba7f8abe58861a47586d767ff35bc1f0961d Catalin(ux) M. BOIE 2009-12-30 22:35:55
Stop Conn if nothing to do. 7f13d71774792aa97b341a2e69bb557d15b6c74a Catalin(ux) M. BOIE 2009-12-06 01:38:12
Improved Conn_split_* and removed a bad leak! f47f85c65ac5781d9419b58b20db632772947c64 Catalin(ux) M. BOIE 2009-12-06 01:24:58
Bump up the version. 4788a6979d84939cc7aaf824ef8e0b7357cab6cc Catalin(ux) M. BOIE 2009-12-07 12:50:16
Duilder updates. 1b717c718189468006ff0e7fb228571e76fb97e6 Catalin(ux) M. BOIE 2009-12-07 12:49:55
Exported Conn_engine_set function. 1c69de5306d302fcd6b3e6351d3e28771b08bb05 Catalin(ux) M. BOIE 2009-11-12 15:18:40
Bumped up the version to 1.0.29. ee219d6016983a64187cfe0866c597419f464535 Catalin(ux) M. BOIE 2009-09-18 12:07:41
Fix Conn_poll(-1)! Stupid me! 4ce77092baec7cbbfcd8d943838aa7eeefedbc8e Catalin(ux) M. BOIE 2009-09-18 12:07:04
Bump up the version to 1.0.28. deea1515d967c7b0708e25fe146799a09c5c2dc8 Catalin(ux) M. BOIE 2009-09-18 11:15:46
Do poll in 1000ms steps, even if Conn_poll is called with != 1 value. Else, triggers are not called! 59b4d5d8db5a4a9048f61ad836e67c824bb1ac95 Catalin(ux) M. BOIE 2009-09-18 11:15:04
Bumbed up the version to 1.0.27. 62ffc3a45094bd4b2d345d7ba37c862e1605050c Catalin(ux) M. BOIE 2009-09-18 09:43:03
More clear what error message is. acd5309c8de872f618a1055258614cf542dadf51 Catalin(ux) M. BOIE 2009-09-18 09:42:38
Compact totals. e85a25c33e9f716317932b6ee7f4b3ae6c459ff9 Catalin(ux) M. BOIE 2009-09-18 09:37:19
Commit 9e267dc05ec2c0b1e50288a6d9a5db5d3677e82e - First round of memory status.
Author: Catalin(ux) M. BOIE
Author date (UTC): 2010-02-04 23:46
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2010-06-11 09:04
Parent(s): 380c378dd92e7a797f0dfec99bed7ce77034933c
Signing key:
Tree: b5adb15b9aff29ecd224cba9b382a23a7310d4aa
File Lines added Lines deleted
Conn.c 7 3
Conn_engine_core.c 14 3
Conn_engine_core.h 3 0
File Conn.c changed (mode: 100644) (index 912f76f..0c34f15)
... ... static void Conn_free_intern(const unsigned int slot)
336 336 static int Conn_grow(void) static int Conn_grow(void)
337 337 { {
338 338 int ret; int ret;
339 unsigned int alloc;
339 unsigned int alloc, increment = 128;
340 340 struct Conn *p, *set; struct Conn *p, *set;
341 341
342 342 Log(10, "%s() Try to grow cells from %d to %d.\n", Log(10, "%s() Try to grow cells from %d to %d.\n",
343 343 __FUNCTION__, __FUNCTION__,
344 344 Conn_allocated, Conn_allocated + 128); Conn_allocated, Conn_allocated + 128);
345 345
346 alloc = Conn_allocated + 128;
346 alloc = Conn_allocated + increment;
347 347
348 348 ret = Conn_engine_grow(alloc); ret = Conn_engine_grow(alloc);
349 349 if (ret != 0) if (ret != 0)
 
... ... static int Conn_grow(void)
353 353 if (p == NULL) if (p == NULL)
354 354 return -1; return -1;
355 355
356 Conn_mem_structs += increment * sizeof(struct Conn);
357
356 358 set = p + Conn_allocated; set = p + Conn_allocated;
357 memset(set, 0, 128 * sizeof(struct Conn));
359 memset(set, 0, increment * sizeof(struct Conn));
358 360 Conns = p; Conns = p;
359 361
360 362 Conn_allocated = alloc; Conn_allocated = alloc;
 
... ... struct Conn *Conn_alloc(void)
406 408 "Memory allocation error2!"); "Memory allocation error2!");
407 409 return NULL; return NULL;
408 410 } }
411 Conn_mem_buffers_in += Conn_default_ibuf - Conns[slot].ibuf_size;
409 412 Conns[slot].ibuf = p; Conns[slot].ibuf = p;
410 413 Conns[slot].ibuf_size = Conn_default_ibuf; Conns[slot].ibuf_size = Conn_default_ibuf;
411 414 } }
 
... ... struct Conn *Conn_alloc(void)
419 422 "Memory allocation error3!"); "Memory allocation error3!");
420 423 return NULL; return NULL;
421 424 } }
425 Conn_mem_buffers_out += Conn_default_obuf - Conns[slot].obuf_size;
422 426 Conns[slot].obuf = p; Conns[slot].obuf = p;
423 427 Conns[slot].obuf_size = Conn_default_obuf; Conns[slot].obuf_size = Conn_default_obuf;
424 428 } }
File Conn_engine_core.c changed (mode: 100644) (index 36c6828..e66be2f)
... ... struct timeval Conn_now;
44 44 unsigned short Conn_level = 0; /* debug level */ unsigned short Conn_level = 0; /* debug level */
45 45 unsigned int Conn_accept_is_allowed; unsigned int Conn_accept_is_allowed;
46 46 unsigned int Conn_accept_is_allowed_last; unsigned int Conn_accept_is_allowed_last;
47 /* memory stuff */
48 unsigned long long Conn_mem_buffers_in = 0;
49 unsigned long long Conn_mem_buffers_out = 0;
50 unsigned long long Conn_mem_structs = 0;
47 51
48 52 struct Conn *Conns = NULL; struct Conn *Conns = NULL;
49 53 unsigned int Conn_inited = 0; unsigned int Conn_inited = 0;
 
... ... char *Conn_state(const struct Conn *C)
273 277 * what = 0 for out buffer, what = 1 for input buffer * what = 0 for out buffer, what = 1 for input buffer
274 278 * returns 0 if OK, -1 on error * returns 0 if OK, -1 on error
275 279 */ */
276 int Conn_try_expand_buf(const unsigned int slot, const int what, const unsigned int needed)
280 int Conn_try_expand_buf(const unsigned int slot, const int what,
281 const unsigned int needed)
277 282 { {
278 283 char *p; char *p;
279 284 unsigned int hm; unsigned int hm;
 
... ... int Conn_try_expand_buf(const unsigned int slot, const int what, const unsigned
330 335 if (what == 0) { if (what == 0) {
331 336 Conns[slot].obuf = p; Conns[slot].obuf = p;
332 337 Conns[slot].obuf_size = hm; Conns[slot].obuf_size = hm;
338 Conn_mem_buffers_out += hm - old_size;
333 339 } else { } else {
334 340 Conns[slot].ibuf = p; Conns[slot].ibuf = p;
335 341 Conns[slot].ibuf_size = hm; Conns[slot].ibuf_size = hm;
342 Conn_mem_buffers_in += hm - old_size;
336 343 } }
344
345
337 346 Log(10, "\tSucces. Old/new size = %u/%u.\n", Log(10, "\tSucces. Old/new size = %u/%u.\n",
338 347 old_size, hm); old_size, hm);
339 348
 
... ... char *Conn_status(const unsigned int flags)
579 588 /* TODO: "len += " is incorrect */ /* TODO: "len += " is incorrect */
580 589 tmp_len = snprintf(tmp, sizeof(tmp), tmp_len = snprintf(tmp, sizeof(tmp),
581 590 "Conn_pending=%d Conn_no/Conn_max=%d/%d Conn_total=%lu" "Conn_pending=%d Conn_no/Conn_max=%d/%d Conn_total=%lu"
582 " Conn_uptime=%lus Conn_allocated=%d Conn_work_to_do=%u\n",
591 " Conn_uptime=%lus Conn_allocated=%d Conn_work_to_do=%u"
592 " Conn_mem_structs=%llu Conn_mem_buffers_in/out=%llu/%llu\n",
583 593 Conn_pending, Conn_no, Conn_max, Conn_total, Conn_pending, Conn_no, Conn_max, Conn_total,
584 Conn_now.tv_sec - Conn_start, Conn_allocated, Conn_work_to_do);
594 Conn_now.tv_sec - Conn_start, Conn_allocated, Conn_work_to_do,
595 Conn_mem_structs, Conn_mem_buffers_in, Conn_mem_buffers_out);
585 596 if (len + tmp_len < max) { if (len + tmp_len < max) {
586 597 strcat(buf, tmp); strcat(buf, tmp);
587 598 len += tmp_len; len += tmp_len;
File Conn_engine_core.h changed (mode: 100644) (index f975897..b341afa)
... ... extern unsigned long Conn_total;
236 236 extern unsigned int Conn_start; extern unsigned int Conn_start;
237 237 extern unsigned int Conn_pending; extern unsigned int Conn_pending;
238 238 extern struct timeval Conn_now; extern struct timeval Conn_now;
239 extern unsigned long long Conn_mem_buffers_in;
240 extern unsigned long long Conn_mem_buffers_out;
241 extern unsigned long long Conn_mem_structs;
239 242
240 243 extern unsigned int Conn_max_send; extern unsigned int Conn_max_send;
241 244 extern unsigned int Conn_max_recv; extern unsigned int Conn_max_recv;
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