Commit message (Collapse) | Author | Age | Files | Lines | ||
---|---|---|---|---|---|---|
... | ||||||
* | Makefile: BSD Make also supports wildcards in targets | Runxi Yu | 2024-10-05 | 1 | -1/+1 | |
| | ||||||
* | Makefile: Add sem.go to source file list | Runxi Yu | 2024-10-05 | 1 | -1/+1 | |
| | ||||||
* | {config,ws}.go, cca.scfg.example: Add perf.course_update_interval | Runxi Yu | 2024-10-05 | 3 | -6/+14 | |
| | | | | | | This causes a drastic increase in performance. References: https://todo.sr.ht/~runxiyu/cca/7 | |||||
* | {courses,wsm}.go: Use in-memory structure to fetch cgroup, not SQL | Runxi Yu | 2024-10-05 | 2 | -26/+18 | |
| | ||||||
* | {config,ws}.go, cca.scfg.example: Remove chanPool/SendQ | Runxi Yu | 2024-10-05 | 3 | -59/+0 | |
| | ||||||
* | ws.go: &usemT{} //exhaustruct:ignore | Runxi Yu | 2024-10-05 | 1 | -1/+1 | |
| | ||||||
* | ws.go: Check error of populateUserCourseGroups | Runxi Yu | 2024-10-05 | 1 | -1/+4 | |
| | ||||||
* | wsm.go: Omit comparison to bool constant | Runxi Yu | 2024-10-05 | 1 | -1/+1 | |
| | ||||||
* | wsm.go: Report error when course doesn't exist | Runxi Yu | 2024-10-05 | 1 | -0/+8 | |
| | | | | | Luckily we encounter a database error before we have the chance to dereference a null pointer. But it's still good practice to check. | |||||
* | {courses,sem,ws,wsm}.go: Second step towards an efficient state propagator | Runxi Yu | 2024-10-05 | 4 | -16/+24 | |
| | | | | References: https://todo.sr.ht/~runxiyu/cca/7 | |||||
* | {courses,sem,ws}.go: First step towards an efficient state propagator | Runxi Yu | 2024-10-05 | 3 | -6/+110 | |
| | | | | References: https://todo.sr.ht/~runxiyu/cca/7 | |||||
* | go.sum: go mod tidy (removing old checksums) | Runxi Yu | 2024-10-05 | 1 | -6/+0 | |
| | ||||||
* | ws.go: Index chanPool by userID, rather than session cookie | Runxi Yu | 2024-10-05 | 1 | -5/+2 | |
| | ||||||
* | {main,utils,ws}.go: Initialize cancelPool directly too | Runxi Yu | 2024-10-05 | 3 | -25/+1 | |
| | ||||||
* | Bump dependencies | Runxi Yu | 2024-10-05 | 2 | -3/+9 | |
| | ||||||
* | {main,ws}.go: Initialize chanPool directly instead of setupChanPool() | Runxi Yu | 2024-10-05 | 2 | -22/+1 | |
| | | | | | | It is possible to use var chanPool = make(map[string](*chan string)) directly during declaration, even if it's a global variable. There is no need to call a function to initialize it. | |||||
* | courses.go: Reformat | Runxi Yu | 2024-10-05 | 1 | -1/+1 | |
| | ||||||
* | {courses,wsm}.go: Add getCourseByID | Runxi Yu | 2024-10-05 | 2 | -10/+8 | |
| | | | | This also deduplicates some code. | |||||
* | {courses,wsm}.go: Add (*courseT).decrementSelectedAndPropagate | Runxi Yu | 2024-10-05 | 2 | -24/+15 | |
| | | | | This is being done quite a few times, so let's make it a function. | |||||
* | {courses,ws,wsm}.go: Update userCourseGroups during choose/unchoose | Runxi Yu | 2024-10-05 | 3 | -12/+51 | |
| | ||||||
* | config.go: Emit warning when fake auth is enabled | Runxi Yu | 2024-10-05 | 1 | -0/+2 | |
| | ||||||
* | bench.go: Don't close request body | Runxi Yu | 2024-10-05 | 1 | -6/+0 | |
| | | | | | | The WebSocket library closes it for us (which is not behavior that I like, but fine). Closing it again causes segmentation faults as Body becomes a null pointer or something like that. | |||||
* | {courses,ws}.go: Populate userCourseGroups in a separate function | Runxi Yu | 2024-10-05 | 2 | -32/+35 | |
| | ||||||
* | {courses,ws}.go: Populate userCourseGroups for each connection | Runxi Yu | 2024-10-04 | 2 | -5/+63 | |
| | | | | | | | | | | | | | | | | | | It is way too expensive to query the database every time we need to check whether a user has chosen a course in a group. Since we can (hopefully) guarantee that there is only one usable connection for any given moment and user, we could store this data along with the connection as a local variable in handleConn, which would be eligible for garbage collection when handleConn exits. Here we create the data structures that globally represent courseTypes and courseGroups, and during the initial stages of handleConn, perform database queries to populate userCourseGroups with the groups that the user has already chosen. Note that the HELLO command handler does similar database queries, and as per the TODO listed in the comments, should be moved up here for efficiency. (HELLO also serves as some sort of an initial connection check; this should probably be replaced with WebSocket's native pings.) | |||||
* | courses.go, schema.sql: Validate course{Type,Group} in server, not SQL | Runxi Yu | 2024-10-04 | 4 | -30/+45 | |
| | ||||||
* | *.sql: New schema with ctypes and cgroups | Runxi Yu | 2024-10-04 | 3 | -18/+39 | |
| | ||||||
* | drop.sql: New SQL script to drop all tables | Runxi Yu | 2024-10-04 | 1 | -0/+3 | |
| | ||||||
* | auth.go: Improve display of OAuth 2.0 errors | Runxi Yu | 2024-10-04 | 1 | -4/+17 | |
| | | | | Implements: https://todo.sr.ht/~runxiyu/cca/9 | |||||
* | config.go: Return errors instead of panicing on auth.fake issues | Runxi Yu | 2024-10-04 | 1 | -3/+11 | |
| | ||||||
* | {config,main}.go, cca.scfg.example: Settable static path | Runxi Yu | 2024-10-04 | 3 | -13/+8 | |
| | | | | | | | | | Because of the poor performance of using NGINX as a reverse proxy, I've added native TLS in commit 4a1a7af76408e956ebc343bf28960fdd00c00c58. Serving static files was already supported, but it was expected that people use a static web server to do so, so we didn't support a configurable static path. Now since reverse proxy setups are discouraged, it makes more sense to be better at serving static files. | |||||
* | staff.html: Initial staff page | Runxi Yu | 2024-10-04 | 1 | -0/+149 | |
| | | | | | It's currently a copy of the student page with a few words changed and no checkboxes | |||||
* | student.html, *.js: {main->student}.js | Runxi Yu | 2024-10-04 | 2 | -1/+1 | |
| | ||||||
* | student.html: {{ .user.Name }} instead of Home in title | Runxi Yu | 2024-10-04 | 1 | -1/+1 | |
| | ||||||
* | bench.go, main.js: Use an HTTPS URL | Runxi Yu | 2024-10-04 | 2 | -2/+2 | |
| | | | | | This URL should be configurable in the JS at least, but I'm not sure how I should be filling out JS templates. I'll leave it hardcoded for now. | |||||
* | {config,main}.go, cca.scfg.example: Support TLS | Runxi Yu | 2024-10-04 | 3 | -8/+65 | |
| | ||||||
* | main.go, cca.scfg.example: Remove FastCGI support | Runxi Yu | 2024-10-04 | 2 | -9/+5 | |
| | | | | | | I would love to serve FastCGI but it is a huge pain to get WebSocket working, at least with NGINX. I don't think OpenBSD httpd would be better at this either. | |||||
* | bench.go: Use more realistic connection numbers for now | Runxi Yu | 2024-10-04 | 1 | -4/+4 | |
| | ||||||
* | postgres_shell.sh: Delete as unnecessary | Runxi Yu | 2024-10-04 | 1 | -3/+0 | |
| | | | | Just use "psql cca" | |||||
* | bench: Add a bit more stress (30000 connections, 30s wait)v0.1.2 | Runxi Yu | 2024-10-03 | 1 | -2/+2 | |
| | ||||||
* | README.md, iadocs/{cover*, crita*}: Update documentation | Runxi Yu | 2024-10-03 | 3 | -39/+67 | |
| | ||||||
* | cca.scfg.example: Listen on 127.0.0.1:5555 only by default | Runxi Yu | 2024-10-03 | 1 | -3/+3 | |
| | | | | | | I would have used IPv6, i.e. [::1]:5555, but our school network only has IPv4 and it'd be easier to keep everything on the same protocol, though this probably wouldn't matter for standard reverse proxy setups. | |||||
* | style.css: Update color scheme | Runxi Yu | 2024-10-03 | 1 | -22/+20 | |
| | ||||||
* | {config,ws}.go, cca.scfg.example: Allow same-user fake auth | Runxi Yu | 2024-10-03 | 3 | -15/+30 | |
| | | | | This is useful for testing whether connection collisions work well. | |||||
* | ws.go: Don't log chanPool changes | Runxi Yu | 2024-10-03 | 1 | -2/+0 | |
| | ||||||
* | schema.sql: users.expr should be BIGINT | Runxi Yu | 2024-10-03 | 1 | -1/+1 | |
| | ||||||
* | {ws,wsm}.go: Handle context cancellations | Runxi Yu | 2024-10-03 | 2 | -5/+94 | |
| | ||||||
* | student.html: Connection closed could be cause by a login elsewhere | Runxi Yu | 2024-10-03 | 1 | -0/+3 | |
| | ||||||
* | lint.sh: Disable nonamedreturns | Runxi Yu | 2024-10-03 | 1 | -1/+1 | |
| | | | | I used named returns to inspect return values (especially error values) | |||||
* | ws.go: Fix memory leak introduced in last commit | Runxi Yu | 2024-10-03 | 1 | -0/+7 | |
| | | | | | | The entry is deleted from cancelPool if and only if cancelPool's cancel function for the user is equal to &newCancel. This compare-and-delete works because of locking. | |||||
* | ws.go: Fix first race condition in cancelPool management | Runxi Yu | 2024-10-03 | 1 | -13/+2 | |
| | | | | | | | | | | | | | | | Cancel occurs in async. When the cancelled function exits, it deletes the entry in cancelPool, and could replace the new routine's cancel function, which is of course undesirable. Therefore this commit causes handleConn to stop deleting from cancelPool entirely. Note that this introduces a memory leak at the size of context.CancelFunc per user, because we are never deleting from cancelPool. This does not actually solve the race condition documented in fc911928 where two new connections start sufficiently close to each other. |