diff --git a/filenum/filenum.tbs b/filenum/filenum.tbs index 05e66c9..ff46c13 100644 --- a/filenum/filenum.tbs +++ b/filenum/filenum.tbs @@ -48,9 +48,16 @@ public function filenum_open(byref signature as string, byref filename as string filenum_debugprint("'"+signature+"' tried to open file '"+filename+"'. This file is already opened on file number "+str(filenum_open)+".") #endif + fd.filenum=f status=PL_FD_STATUS_OK filenum_open=f - exit function + if fd.fileopened=YES then + exit function + else + sys.trace("closing\r\n") + fd.close() + exit for + end if end if end if next f diff --git a/http/http.tbs b/http/http.tbs index 49828f5..da88d93 100644 --- a/http/http.tbs +++ b/http/http.tbs @@ -638,7 +638,7 @@ sub http_sock_state_update(newstatesimple as enum pl_sock_state_simple) if http_check_socket_list()=NG then exit sub end if - if sock.statesimple=PL_SSTS_CLOSED and http_request_item.state >= DNS_COMPLETE then + if sock.statesimple=PL_SSTS_CLOSED and http_request_item.state >= DNS_COMPLETE and sock.rxlen=0 then http_failed("Connection closed") exit sub end if