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)
Simplified expand_buf and also fixed an out-of-bounds wrinting. a2a507f235f7847277c2a485af8efb8efaa1ffa7 Catalin(ux) M. BOIE 2009-04-17 12:03:34
Bump up the version. b720ca953940baf51a3e8263e6ec5d397a1c1ff2 Catalin(ux) M. BOIE 2009-04-14 12:39:01
Fixed Conn_rtrim. 5f12cd953b0b998db8530eaed30b91bb181b7b26 Catalin(ux) M. BOIE 2009-04-14 12:38:39
Really fixed Conn_split_get. 5ab1e0a47574fc6776e014be3d8150a048866607 Catalin(ux) M. BOIE 2009-04-14 08:34:38
Added Conn_alphanum (test if a string is alpha numeric or not). 0bb8d19eed947aa82640610a0d894141e466105a Catalin(ux) M. BOIE 2009-04-14 08:22:02
Reverse the meaning of Conn_split_get_e and Conn_split_get. 836229353a26ecc1bac762ece6cf42319113f5b1 Catalin(ux) M. BOIE 2009-04-14 08:21:35
Before calling callback in Conn_for_every_line, just trim '\r'. 51e532893e74c4bee9b6847732442536e79eb2a0 Catalin(ux) M. BOIE 2009-04-14 06:39:29
Added Conn_rtrim function. c37737a16e3d9de95cf659bae546de8808a3e3ed Catalin(ux) M. BOIE 2009-04-14 06:26:16
Revert "Conn_get_line removes also '\r' now." 9d56ef9813225fe1127a2d5800c124aa65d5e1d2 Catalin(ux) M. BOIE 2009-04-14 06:20:50
Changed Conn_split to not modify original line. 2f0d734f54b243356d0d4468691af50aad9e667a Catalin(ux) M. BOIE 2009-04-14 06:00:26
Added Conn_split_get_ull (unsigned long long). 735e92324db56d5e9875f4e123102fc1e995cb4d Catalin(ux) M. BOIE 2009-04-13 22:13:04
Conn_get_line removes also '\r' now. c1e5a9915b3ae6196a68fb1e7f73f295bef1737c Catalin(ux) M. BOIE 2009-04-13 21:56:47
Re-export Conn_get lost somehow. 293f7aaed4f39de54821c8863023adb0e00234ac Catalin(ux) M. BOIE 2009-04-13 21:33:19
Bump the version. d74d67d1327c8873c715906feeb8b4f053fff70b Catalin(ux) M. BOIE 2009-03-17 13:07:01
Added splitting functions. It gets easier to write ascii line client/server app. 48e73f48d8c264e944dfd211e926ca3ad8f879d6 Catalin(ux) M. BOIE 2009-03-17 13:06:19
Do not build examples by default. 9dafc6232f426f361047a1836832e2c97823d14c Catalin(ux) M. BOIE 2009-03-17 09:59:14
Bump up the version. 47a4be6a1ae721a7b9d0e07db5a288985163758c Catalin(ux) M. BOIE 2009-03-17 09:01:10
Added Conn_addr_info - check what family an address is. 10087d1dec5592e4a5396df09aade7d963cf1ea4 Catalin(ux) M. BOIE 2009-03-17 08:55:47
Bump up the version. 4ce4f82faa025d9a386538d1db5d74a443baf62a Catalin(ux) M. BOIE 2009-03-10 09:22:37
Do not try to close free state slots. f17b6d92d668f72de10967ae9178131916db64c8 Catalin(ux) M. BOIE 2009-03-09 10:29:35
Commit a2a507f235f7847277c2a485af8efb8efaa1ffa7 - Simplified expand_buf and also fixed an out-of-bounds wrinting.
Author: Catalin(ux) M. BOIE
Author date (UTC): 2009-04-17 12:03
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2009-04-17 12:03
Parent(s): b720ca953940baf51a3e8263e6ec5d397a1c1ff2
Signing key:
Tree: 324ff64fb227b954117e6fdffb7681e1c4f2ed21
File Lines added Lines deleted
Conn_engine_core.c 30 26
File Conn_engine_core.c changed (mode: 100644) (index 7c6b482..a6b6899)
... ... int Conn_try_expand_buf(struct Conn *C, const int what, const int needed)
255 255 char *p; char *p;
256 256 unsigned int hm; unsigned int hm;
257 257 unsigned int slot, old_size, amount, head, tail; unsigned int slot, old_size, amount, head, tail;
258 unsigned int default_buf, buf_size, max_buf;
259 char *pbuf;
258 260
259 261 slot = C->slot; slot = C->slot;
260 262
261 263 if (what == 0) { if (what == 0) {
262 264 head = C->obuf_head; head = C->obuf_head;
263 265 tail = C->obuf_tail; tail = C->obuf_tail;
266 default_buf = Conn_default_obuf;
267 old_size = Conns[slot].obuf_size;
268 buf_size = Conns[slot].obuf_size;
269 max_buf = Conn_max_obuf;
270 pbuf = Conns[slot].obuf;
264 271 } else { } else {
265 272 head = C->ibuf_head; head = C->ibuf_head;
266 273 tail = C->ibuf_tail; tail = C->ibuf_tail;
274 default_buf = Conn_default_ibuf;
275 old_size = Conns[slot].ibuf_size;
276 buf_size = Conns[slot].ibuf_size;
277 max_buf = Conn_max_ibuf;
278 pbuf = Conns[slot].ibuf;
267 279 } }
268 280
269 281 Log(10, "\tTry to expand buffer on slot %u for [%s] needed=%d head=%u tail=%u.\n", Log(10, "\tTry to expand buffer on slot %u for [%s] needed=%d head=%u tail=%u.\n",
 
... ... int Conn_try_expand_buf(struct Conn *C, const int what, const int needed)
271 283 head, tail); head, tail);
272 284
273 285 amount = needed; amount = needed;
286 if (amount < default_buf)
287 amount = default_buf;
288
289 hm = buf_size + amount;
290 if (hm > max_buf)
291 hm = max_buf;
292
293 /* Seems we are not allowed to grow larger */
294 if (hm <= buf_size)
295 return -1;
296
297 p = realloc(pbuf, hm);
298 if (p == NULL) {
299 Log(3, "Cannot realloc obuf!\n");
300 return -1;
301 }
274 302
275 303 if (what == 0) { if (what == 0) {
276 if (amount < Conn_default_obuf)
277 amount = Conn_default_obuf;
278 old_size = Conns[slot].obuf_size;
279 hm = Conns[slot].obuf_size + amount;
280 if (hm > Conn_max_obuf)
281 hm = Conn_max_obuf;
282 p = realloc(Conns[slot].obuf, hm);
283 if (p == NULL) {
284 Log(3, "Cannot realloc obuf!\n");
285 return -1;
286 }
287 304 Conns[slot].obuf = p; Conns[slot].obuf = p;
288 305 Conns[slot].obuf_size = hm; Conns[slot].obuf_size = hm;
289 Log(10, "\tSucces. Old/new size = %u/%u.\n",
290 old_size, Conns[slot].obuf_size);
291 306 } else { } else {
292 if (amount < Conn_default_ibuf)
293 amount = Conn_default_ibuf;
294 old_size = Conns[slot].ibuf_size;
295 hm = Conns[slot].ibuf_size + amount;
296 if (hm > Conn_max_ibuf)
297 hm = Conn_max_ibuf;
298 p = realloc(Conns[slot].ibuf, hm);
299 if (p == NULL) {
300 Log(3, "Cannot realloc ibuf!\n");
301 return -1;
302 }
303 307 Conns[slot].ibuf = p; Conns[slot].ibuf = p;
304 308 Conns[slot].ibuf_size = hm; Conns[slot].ibuf_size = hm;
305 Log(10, "\tSucces. Old/new size = %u/%u.\n",
306 old_size, Conns[slot].ibuf_size);
307 309 } }
310 Log(10, "\tSucces. Old/new size = %u/%u.\n",
311 old_size, hm);
308 312
309 313 return 0; return 0;
310 314 } }
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