@@ -65,6 +65,7 @@ static const struct option options[] = {{"port", required_argument, NULL, 'p'},
65
65
#if LWS_LIBRARY_VERSION_NUMBER >= 4000000
66
66
{"ping-interval" , required_argument , NULL , 'P' },
67
67
#endif
68
+ {"srv-buf-size" , required_argument , NULL , 'f' },
68
69
{"ipv6" , no_argument , NULL , '6' },
69
70
{"ssl" , no_argument , NULL , 'S' },
70
71
{"ssl-cert" , required_argument , NULL , 'C' },
@@ -83,7 +84,7 @@ static const struct option options[] = {{"port", required_argument, NULL, 'p'},
83
84
{"version" , no_argument , NULL , 'v' },
84
85
{"help" , no_argument , NULL , 'h' },
85
86
{NULL , 0 , 0 , 0 }};
86
- static const char * opt_string = "p:i:U:c:H:u:g:s:w:I:b:P:6aSC:K:A:Wt:T:Om:oqBd:vh" ;
87
+ static const char * opt_string = "p:i:U:c:H:u:g:s:w:I:b:P:f: 6aSC:K:A:Wt:T:Om:oqBd:vh" ;
87
88
88
89
static void print_help () {
89
90
// clang-format off
@@ -116,6 +117,7 @@ static void print_help() {
116
117
#if LWS_LIBRARY_VERSION_NUMBER >= 4000000
117
118
" -P, --ping-interval Websocket ping interval(sec) (default: 5)\n"
118
119
#endif
120
+ " -f, --srv-buf-size Maximum chunk of file (in bytes) that can be sent at once, a larger value may improve throughput (default: 4096)\n"
119
121
#ifdef LWS_WITH_IPV6
120
122
" -6, --ipv6 Enable IPv6 support\n"
121
123
#endif
@@ -463,6 +465,14 @@ int main(int argc, char **argv) {
463
465
retry .secs_since_valid_hangup = interval + 7 ;
464
466
} break ;
465
467
#endif
468
+ case 'f' : {
469
+ int serv_buf_size = parse_int ("srv-buf-size" , optarg );
470
+ if (serv_buf_size < 0 ) {
471
+ fprintf (stderr , "ttyd: invalid srv-buf-size: %s\n" , optarg );
472
+ return -1 ;
473
+ }
474
+ info .pt_serv_buf_size = serv_buf_size ;
475
+ } break ;
466
476
case '6' :
467
477
info .options &= ~(LWS_SERVER_OPTION_DISABLE_IPV6 );
468
478
break ;
@@ -553,9 +563,9 @@ int main(int argc, char **argv) {
553
563
if (ssl ) {
554
564
info .ssl_cert_filepath = cert_path ;
555
565
info .ssl_private_key_filepath = key_path ;
556
- #ifndef LWS_WITH_MBEDTLS
566
+ #ifndef LWS_WITH_MBEDTLS
557
567
info .ssl_options_set = SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1 ;
558
- #endif
568
+ #endif
559
569
if (strlen (ca_path ) > 0 ) {
560
570
info .ssl_ca_filepath = ca_path ;
561
571
info .options |= LWS_SERVER_OPTION_REQUIRE_VALID_OPENSSL_CLIENT_CERT ;
0 commit comments