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)
Fixed the case when all connection are closed (app didn't exit). 79d111839a75354c60a675a5c7ff328a38d4b8c8 Catalin(ux) M. BOIE 2009-06-22 14:50:59
Bump up the version to 1.0.21. 574437c47f27ead82d5a891be30312c6725d5142 Catalin(ux) M. BOIE 2009-05-20 14:29:02
Fixed a use of an uninit variable! Oops! 381473f2077d895d5064f1ea2e82d5a215ad5770 Catalin(ux) M. BOIE 2009-05-20 14:28:24
Bump up the version to 1.0.20. 2270d4d69a1479a68c61c908bb2e421984f2d785 Catalin(ux) M. BOIE 2009-05-20 14:10:52
Fixed an underflow in Conn_rtrim. Oops! dd361465e5f31adcc337b4eca9ebeec6c1713c42 Catalin(ux) M. BOIE 2009-05-20 14:10:28
Missed a '('. Oops! 920f9fda5fecd14e1cfcdb8bd66164f3bd215b93 Catalin(ux) M. BOIE 2009-05-20 14:05:59
Try harder to respect the trigger interval; in the start fire after interval. e7e5a52e7a6b7ad59da38bf660269e025f10ade4 Catalin(ux) M. BOIE 2009-05-06 11:19:09
Bump up the version. e3723ad356330457959f6d9100be81d7eaacc57d Catalin(ux) M. BOIE 2009-04-17 14:33:30
Added reconnect executable to .gitignore. 585adaa455a4ab751733bd872faf10c97a880d17 Catalin(ux) M. BOIE 2009-04-17 14:33:06
Made the server example (s.c) nicer and did more error checking. 519cf83b2d28bee0d3bb25bbc962b3ef5677ee92 Catalin(ux) M. BOIE 2009-04-17 14:32:07
Added a reconnect example. 59b8156a8c5d17c90b5b064b1e1043b365ddac0a Catalin(ux) M. BOIE 2009-04-17 14:31:47
Show a nicer value if the reconnect feat was never used. f51cf254286f76721e517eb69aa00695bdb3b2f5 Catalin(ux) M. BOIE 2009-04-17 14:30:59
Reget the time, even if no events. Else, the expiration will not work. a1167cc19d739d62d6a21fd238c701c60a64cf6d Catalin(ux) M. BOIE 2009-04-17 14:12:57
Be more verbose and show also the flags. 377f288df5d1fbde5c14276e8256fb88216d8761 Catalin(ux) M. BOIE 2009-04-17 13:01:59
Changed split test to show that we can get past 4096 limit. 8ae8fefc1f2d19dbc893a95818ecadcc5c3014e0 Catalin(ux) M. BOIE 2009-04-17 12:46:03
Improved Conn_split (and remove the limitation to 4096 'right' value. ec46e3c94da65fe94ed109727fd3dcb50384a44e Catalin(ux) M. BOIE 2009-04-17 12:31:53
Removed an unsused variable. 1fa664bac9482c6e053bb3ea1d06280b66dadfed Catalin(ux) M. BOIE 2009-04-17 12:04:46
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
Commit 79d111839a75354c60a675a5c7ff328a38d4b8c8 - Fixed the case when all connection are closed (app didn't exit).
Signed-off-by: Catalin(ux) M. BOIE <catab@embedromix.ro>
Author: Catalin(ux) M. BOIE
Author date (UTC): 2009-06-22 14:50
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2009-09-02 15:42
Parent(s): 574437c47f27ead82d5a891be30312c6725d5142
Signer:
Signing key:
Signing status: N
Tree: 0634a9b5c0cf91d92d6a0b81e84c72b3c4fc96b5
File Lines added Lines deleted
Conn.c 28 12
File Conn.c changed (mode: 100644) (index d85b0e9..5f514e0)
... ... static void Conn_free_intern(struct Conn *C)
263 263 } else { } else {
264 264 C->type = Conn_type_UNK; C->type = Conn_type_UNK;
265 265 C->state = CONN_STATE_FREE; C->state = CONN_STATE_FREE;
266
267 /* Allow connections */
268 Conn_accept_is_allowed = 1;
269
270 /* Decrement the number of busy connections */
271 Conn_no--;
266 272 } }
267 273 } }
268 274
 
... ... static void Conn_move_slot(const unsigned int dst, const unsigned int src)
1103 1109 if (dst == src) if (dst == src)
1104 1110 return; return;
1105 1111
1106 Log(10, "%s: Moving slot=%u (id=%llu) over %d...\n",
1107 __FUNCTION__, src, Conns[src].id, dst);
1112 Log(10, "%s: Moving id %llu from slot %u to slot %d...\n",
1113 __FUNCTION__, Conns[src].id, src, dst);
1108 1114
1109 1115 tmp = Conns[dst]; tmp = Conns[dst];
1110 1116 Conns[dst] = Conns[src]; Conns[dst] = Conns[src];
1111 Conns[dst].slot = dst;
1112 1117 Conns[src] = tmp; Conns[src] = tmp;
1113 1118
1114 Conn_engine_move_slot(dst, src);
1115
1116 Conn_no--;
1119 Conns[dst].slot = dst;
1117 1120
1118 /* We made some space, so accepting again connection */
1119 Conn_accept_is_allowed = 1;
1121 Conn_engine_move_slot(dst, src);
1120 1122 } }
1121 1123
1122 1124 /* /*
 
... ... int Conn_poll(const int timeout)
1127 1129 { {
1128 1130 int ret; int ret;
1129 1131 int timeout2; int timeout2;
1130 unsigned int i;
1132 unsigned int i, last;
1131 1133 struct Conn *C; struct Conn *C;
1132 1134
1133 1135 Log(11, "Conn_poll(timeout=%d Conn_no=%d)\n", Log(11, "Conn_poll(timeout=%d Conn_no=%d)\n",
 
... ... int Conn_poll(const int timeout)
1155 1157 C = &Conns[i]; C = &Conns[i];
1156 1158
1157 1159 /* Closing connection if it is in error state */ /* Closing connection if it is in error state */
1158 if (C->error_state > 0)
1160 if (C->error_state > 0) {
1161 /*
1162 * Save last position because Conn_free_intern
1163 * decrements Conn_no
1164 */
1165 last = Conn_no - 1;
1159 1166 Conn_free_intern(C); Conn_free_intern(C);
1167 Conn_move_slot(i, last);
1168 continue;
1169 }
1160 1170
1161 1171 if (C->state == CONN_STATE_FREE) { if (C->state == CONN_STATE_FREE) {
1162 Conn_move_slot(i, Conn_no - 1);
1163 i++;
1172 last = Conn_no - 1;
1173 Conn_move_slot(i, last);
1164 1174 continue; continue;
1165 1175 } }
1166 1176
 
... ... int Conn_poll(const int timeout)
1176 1186 /* Blocking accept if full queue or unblock if not */ /* Blocking accept if full queue or unblock if not */
1177 1187 Conn_accept_allow(); Conn_accept_allow();
1178 1188
1189 /* Any work left to do? */
1190 if (Conn_no == 0) {
1191 Log(10, "Nothing remained to poll for!\n");
1192 return 0;
1193 }
1194
1179 1195 if (timeout == -1) if (timeout == -1)
1180 1196 goto loop; goto loop;
1181 1197
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