File tree Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -196,11 +196,16 @@ export async function preview(
196196 // serve project
197197 for await ( const conn of listener ) {
198198 ( async ( ) => {
199- for await ( const { request , respondWith } of Deno . serveHttp ( conn ) ) {
200- try {
199+ try {
200+ for await ( const { request , respondWith } of Deno . serveHttp ( conn ) ) {
201201 await respondWith ( handler ( request ) ) ;
202- } catch ( err ) {
203- warning ( err . message ) ;
202+ }
203+ } catch ( err ) {
204+ warning ( err . message ) ;
205+ try {
206+ conn . close ( ) ;
207+ } catch {
208+ //
204209 }
205210 }
206211 } ) ( ) ;
Original file line number Diff line number Diff line change @@ -534,13 +534,20 @@ export async function serveProject(
534534
535535 // serve project
536536 const handler = httpFileRequestHandler ( handlerOptions ) ;
537+
538+ // serve project
537539 for await ( const conn of listener ) {
538540 ( async ( ) => {
539- for await ( const { request , respondWith } of Deno . serveHttp ( conn ) ) {
540- try {
541+ try {
542+ for await ( const { request , respondWith } of Deno . serveHttp ( conn ) ) {
541543 await respondWith ( handler ( request ) ) ;
542- } catch ( err ) {
543- warning ( err . message ) ;
544+ }
545+ } catch ( err ) {
546+ warning ( err . message ) ;
547+ try {
548+ conn . close ( ) ;
549+ } catch {
550+ //
544551 }
545552 }
546553 } ) ( ) ;
You can’t perform that action at this time.
0 commit comments