catalinux / Conn (public) (License: LGPLv2) (since 2016-03-01) (hash sha1)
Net library for easy building ipv4/ipv6 network daemons/clients

/TODO (f865b302eb1249a302b89f04198b3ae1f5b28f48) (4105 bytes) (mode 100644) (type blob)

== SHOWSTOPPERS ==

== HIGH PRIORITY ==
[ ] Cache getaddrinfo responses
[ ] Replace Conn_X with Conn_get_socket_X!
[ ] Use shutdown(2) before closing connection (http://www.developerweb.net/forum/archive/index.php/t-2940.html).
[ ] Switch all pointers to callbacks to a single callback with paramenters +
	a flag that will say for what type of callbacks to call the callback.
[ ] Conn.c:532:19: warning: variable 'psa' set but not used [-Wunused-but-set-variable] & Co.
[ ] 

== LOW PRIORITY ==
[ ] How should wpool will be used?
	C = Conn_alloc();
	Conn_set_socket_domain(C, PF_INET);
	Conn_set_socket_type(C, SOCK_STREAM);
	Conn_set_socket_bind_addr(C, "127.0.0.1");
	Conn_set_socket_bind_port(C, 60000);
	Conn_commit(C);
	Conn_poll();
		epoll_wait
		accept
		w = choose a worker
		epoll_ctl(w->epoll_fd, new_fd);
		somehow enqueue 'accept' trigger

[ ] See http://highscalability.com/blog/2012/9/10/russ-10-ingredient-recipe-for-making-1-million-tps-on-5k-har.html
[ ] Dump all memory statistics
[ ] SCTP
[ ] .error_state -> error_type
[ ] if (.error_state...) -> if (.state == CONN_STATE_ERROR)
[ ] Audit CONN_STATE_EMPTY vs CONN_STATE_FREE
[ ] Add a function to set the maximum number of connections.
[ ] Fix the whole list scanning for expiration, band and closing.
[ ] Put callbacks in a structure to free some space from struct Conn.
[ ] wpool: When we free a Conn structure, we have to Conn_del_wp!
[ ] wpool: What if we add master sockets also to workers and do nothing in main
	thread? Check ma.c example. Verified: accept waks in only one thread.
	Still to check if epoll wakes in all threads! Seems it wakes all threads!
	Not very good.
[ ] Investigate splice.
[ ] Investigate MSG_MORE as an alternative to CORK or writev.
[ ] 

[ ] Check if we are swapping and warn.
[ ] Log faults and io.
[ ] We must have a single set of pointers to callback, not many. At Conn creation,
	we copy the default set and than replace, on request, some members.
	This will simplify the code.
[ ] Add access control
	Conn_ac_set_default(C, CONN_AC_DENY) - default deny (or CONN_AC_ALLOW)
	Conn_ac_add(C, CONN_AC_ALLOW, "2001::1/64"); - for ipv6
	Conn_ac_add(C, CONN_AC_ALLOW, "192.168.0.0/25"); - for ipv4
[ ] A la redir stuff

[ ] Bridge 2 connections together for proxy stuff.
[ ] Check PACKET: can we send with "send" without knowing the MAC?
[ ] UDP
[ ] Ce se intimpla daca se ajunge la ~ sfirsitul buffer-ului si nu pot inca sa
	procesez datele? We should log and close the connection. It is
	programmer's fault or a DoS.
[ ] Queue for delete/trytoconnect/etc.

Performance:
[ ] net.core.somaxconn
[ ]	Take care for /proc/net/netstat
[ ]	/proc/sys/net/ipv4/tcp_mem
	Now (512M): 49152 65536 98304
	Now (256M): 24576 32768 49152 - 55 conns/sec

	Test with: 80000 120000 240000 - 92 conns/sec
	Test with 160000 240000 480000 - 96 conns/sec

	After:
		echo "16000 64000 512000" > tcp_[rw]mem - 96

	After echo 1 > /proc/sys/net/ipv4/tcp_low_latency - 156 conns/sec

Pentru a reduce numarul de conexiuni in TIME-WAIT:
	echo 200 > /proc/sys/net/ipv4/tcp_max_tw_buckets

[ ] Add loadbalancing and failover in the base code.
[ ] Automaticaly put \0 at the end of receive data. What for?!
[ ] Add the possibility to wait for an char/string before calling recv callback.
	Maybe do this with socket filtering or in kernel?
[ ] Change socket buffer accordingly with user settings to minimize
	needed memory.

[ ] Dump how many memory is in use vor various parts of the internal data.
[ ] Do not mix slot and id and fd in examples.
[ ] Test suite
[ ] Free memory when the number of connections is going down.
[ ] Bandwidth part should have a separate pointer, to not load too much Conn structure.
[ ] Maybe we should have Bandwidth classes so we can group connections.
[ ] http://www.erlang-solutions.com/thesis/tcp_optimisation/tcp_optimisation.html
[ ] 

=== When we switch to Conn version 2 library ===
[ ] Conn_socket will cann Conn_socket_proto
[ ] use enums!
[ ] All internal variables of Conn structure must not be exposed directly.
[ ] http://urbanairship.com/blog/2010/09/29/linux-kernel-tuning-for-c500k/
[ ] 


Mode Type Size Ref File
100644 blob 94 2e97920b91646e1a8c2438ca375e2aaae22793fb .gitignore
100644 blob 169 c003c095218f64ad33aeb89987f61eb575557d96 .mailmap
100644 blob 1945 fecf0e7a7e8580485101a179685aedc7e00affbb Changelog.pre109
100644 blob 21061 1e342eeda192ed23167120aa5c9522571faaa74f Conn.c
100644 blob 1629 fd37073a80de54c788aa8129c08cc49ad3643e59 Conn.h
100644 blob 835 3e3dff5bad664ce3c207f971f93c3a9125690e5e Conn.spec.in
100644 blob 316 6367f3c67317658261b02e15f96b97692b3a718c Conn_config.h.in
100644 blob 39492 8a43a5bdb2292265a05d95e227a1f33d1191576a Conn_core.c
100644 blob 9758 0a0b0f888dcccea9d91b786600a31f8d924f6ec3 Conn_core.h
100644 blob 4644 e8bcfbb931220c13e8f4c7af1eff2e7f1e53d5f4 Conn_wpool.c
100644 blob 730 076e0f4e7c2c54e0b475027cd5f78b6dc68295fe Conn_wpool.h
100644 blob 30 d987fa5df957830331139935d517009e2911b0cf INSTALL
100644 blob 25275 92b8903ff3fea7f49ef5c041b67a087bca21c5ec LICENSE
100644 blob 1058 96a7eb0e8cdc2356572dbb738490d1d84e145a36 Makefile.in
100644 blob 192 5b11bdfb23857d8588845465aef993b320596b44 README
100644 blob 4105 f865b302eb1249a302b89f04198b3ae1f5b28f48 TODO
100755 blob 23 d33bb6c4ecdce1390ce1db3c79ea3b93e22ea755 configure
040000 tree - d4c9c4a69c5cfa2a84316967185f1661b6817779 docs
100755 blob 13311 a6e2825b35f915e6d64c2a981fa3b6266b2bf587 duilder
100644 blob 325 809c9f357dc746e5f95ee12ecb7efb6412893113 duilder.conf
040000 tree - 22ea271ed7aacd59fd17512ff219f9406254c661 examples
040000 tree - 751693d0803f700dd060788cc9383aa24b472267 tests
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