AmendHub

Download:

jcs

/

detritus

/

amendments

/

21

main: Make SCSI TLS optional, just disable Gemini when it's not found


jcs made amendment 21 about 1 year ago
--- detritus.h Sun Nov 3 11:22:22 2024 +++ detritus.h Mon Nov 4 11:11:36 2024 @@ -105,5 +105,6 @@ size_t scsi_tls_read(uint8_t tls_id, unsigned char **b size_t scsi_tls_write(uint8_t tls_id, unsigned char *buf, size_t buf_size, bool cipher); void scsi_cleanup(void); +bool scsi_can_do_tls(void); #endif \ No newline at end of file --- gemini.c Sun Nov 3 20:05:38 2024 +++ gemini.c Mon Nov 4 11:14:02 2024 @@ -99,6 +99,11 @@ gemini_init_request(page_handle pageh) goto done; } + if (!scsi_can_do_tls()) { + warn("No TLS accelerator found, cannot make Gemini requests"); + goto fail; + } + req = xmalloczero(sizeof(struct gemini_request)); if (req == NULL) { warn("Out of memory"); --- main.c Sat Nov 2 16:44:31 2024 +++ main.c Mon Nov 4 11:15:12 2024 @@ -69,18 +69,13 @@ SetItem(bookmarks_menu, 2, "\pgopher://gopher.floodgap DrawMenuBar(); - progress("Finding BlueSCSI TLS Accelerator..."); - if (scsi_find_tls() < 0) { - progress(NULL); - panic("No BlueSCSI TLS device found"); - } - progress(NULL); - if (_TCPInit() != 0) panic("Failed initializing MacTCP"); browser_init(); + scsi_find_tls(); + while (!quitting) { WaitNextEvent(everyEvent, &event, 5L, 0L); --- scsi.c Thu Oct 24 13:55:19 2024 +++ scsi.c Mon Nov 4 11:11:57 2024 @@ -58,6 +58,12 @@ static unsigned char scsi_buf[2048]; short scsi_io(unsigned char *cdb, unsigned long cdb_len, short io_type, unsigned char *buf, unsigned long len); +bool +scsi_can_do_tls(void) +{ + return (tls_scsi_id != -1); +} + short scsi_find_tls(void) {