shithub: riscv

Download patch

ref: daba1155fab35e2ddc3b1788649a3d2858c1d931
parent: 3914893b89ffe0e45fd20c035dcfcfed3051eaec
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Aug 19 17:58:34 EDT 2023

devtls: allow larger than MaxRecLen (16k) writes

tlsbwrite() already handles atomic chunking into
MaxRecLen TLS records (sans the interrupt handling).

Now we can allow up to qiomaxatomic (64k) writes.

--- a/sys/src/9/port/devtls.c
+++ b/sys/src/9/port/devtls.c
@@ -485,7 +485,17 @@
 	c->mode = openmode(omode);
 	c->flag |= COPEN;
 	c->offset = 0;
-	c->iounit = MaxRecLen;
+	switch(t){
+	case Qdata:
+		c->iounit = qiomaxatomic;
+		break;
+	case Qhand:
+		c->iounit = MaxRecLen;
+		break;
+	default:
+		c->iounit = 0;
+		break;
+	}
 	return c;
 }
 
@@ -1346,6 +1356,8 @@
 		if(waserror()){
 			if(strcmp(up->errstr, "interrupted") != 0)
 				tlsError(tr, "channel error");
+			else if(bb != nil)
+				continue;
 			nexterror();
 		}
 		devtab[tr->c->type]->bwrite(tr->c, nb, 0);
@@ -1592,6 +1604,7 @@
 			b->wp += m;
 
 			tlsbwrite(c, b, offset);
+			offset += m;
 
 			p += m;
 		}while(p < e);