Overview
Comment: | Speculative fix for wrong server access issue |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.80 |
Files: | files | file ages | folders |
SHA1: |
0f348aa84ba7889265c616f23b700efd |
User & Date: | mrwellan on 2023-03-03 02:16:30 |
Other Links: | branch diff | manifest | tags |
Context
2023-03-03
| ||
17:37 | wip check-in: abb2c73974 user: mrwellan tags: v1.80 | |
02:16 | Speculative fix for wrong server access issue check-in: 0f348aa84b user: mrwellan tags: v1.80 | |
2023-03-02
| ||
21:32 | Improve some of the logic around servers check-in: 87813c75d2 user: mrwellan tags: v1.80 | |
Changes
Modified api.scm from [edf4eba965] to [1736f4bcb3].
︙ | |||
246 247 248 249 250 251 252 | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | + + - + + + - + | (delay-wait (if (> newcount 10) (- newcount 10) 0))) (set! *api-process-request-count* newcount) (set! *db-last-access* (current-seconds)) (match indat ((cmd run-id params meta) (let* ((ttdat *server-info*) (server-state (tt-state ttdat)) |
︙ |
Modified tcp-transportmod.scm from [6b42c5c5cc] to [2182e473e2].
︙ | |||
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | + + + + | ;; Used for BOTH clients and servers (defstruct tt ;; client related (conns (make-hash-table)) ;; dbfname -> conn ;; server related (state 'starting) (areapath #f) (host #f) (port #f) (conn #f) (cleanup-proc #f) (handler #f) ;; receives data and responds (socket #f) (thread #f) (host-port #f) (cmd-thread #f) (ro-mode #f) (ro-mode-checked #f) (last-access (current-seconds)) (servinf-file #f) (last-serv-start 0) ) ;; make ttdat visible (define *server-info* #f) (define (tt:make-remote areapath) (make-tt areapath: areapath)) ;; 1 ... or #f (define (tt:valid-run-id run-id) (or (number? run-id) (not run-id))) |
︙ | |||
137 138 139 140 141 142 143 | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | - - - - - - - - - - + + + + + + + + + + + + + + + + - + - + | dbfname: dbfname servinf-file: servinffile server-id: server-id server-start: start-time pid: pid))) (hash-table-set! (tt-conns ttdat) dbfname conn) ;; verify we can talk to this server |
︙ | |||
351 352 353 354 355 356 357 358 359 360 361 362 363 364 | 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | + | (nosyncdbpath (conc areapath"/.megatest")) (cleanup (lambda () (if (tt-cleanup-proc ttdat) ((tt-cleanup-proc ttdat))) (dbfile:with-no-sync-db nosyncdbpath (lambda (db) (db:no-sync-del! db dbfname)))))) (set! *server-info* ttdat) (let loop ((count 0)) (if (> count 240) (begin (debug:print 0 *default-log-port* "FATAL: Could not start a tcp server, giving up.") (exit 1)) (if (not (tt-port ttdat)) ;; no connection yet (begin |
︙ | |||
383 384 385 386 387 388 389 390 391 392 393 394 395 396 | 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | + | #t (let* ((lockinfo (dbfile:with-no-sync-db nosyncdbpath (lambda (db) (db:no-sync-get-lock db dbfname)))) (success (car lockinfo))) (if success (begin (tt-state-set! ttdat 'running) (debug:print 0 *default-log-port* "Got server lock for "dbfname) (set! db-locked-in #t) #t) (begin (debug:print 0 *default-log-port* "Failed to get server lock for "dbfname) #f))))) (else |
︙ | |||
468 469 470 471 472 473 474 475 476 477 478 479 480 481 | 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | + | ;; (thread-join! (udat-cmd-thread uconn)) ;; (tcp-close (udat-socket uconn))) ;; ;; (define (tt:shutdown-server ttdat) (let* ((cleanproc (tt-cleanup-proc ttdat))) (tt-state-set! ttdat 'shutdown) (if cleanproc (cleanproc)) (tcp-close (tt-socket ttdat)) ;; close up ports here )) ;; (define (wait-and-close uconn) ;; (thread-join! (tt-cmd-thread uconn)) ;; (tcp-close (tt-socket uconn))) |
︙ |