shithub: riscv

Download patch

ref: fe320116dae05e61481e75297f402f1af956c5d6
parent: f5fcb42cffce91e8142c6934e398c11c95e907ec
parent: cbdf48454fece6380a0ad713d53902f65bf9308b
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Sep 18 22:14:03 EDT 2016

merge

--- a/sys/src/cmd/webfs/http.c
+++ b/sys/src/cmd/webfs/http.c
@@ -100,8 +100,8 @@
 
 	snprint(addr, sizeof(addr), "tcp!%s!%s", u->host, u->port ? u->port : u->scheme);
 
+	qlock(&hpool);
 	if(cached){
-		qlock(&hpool);
 		for(p = nil, h = hpool.head; h; p = h, h = h->next){
 			if(strcmp(h->addr, addr) == 0){
 				if(p)
@@ -113,9 +113,9 @@
 				return h;
 			}
 		}
-		hpool.active++;
-		qunlock(&hpool);
 	}
+	hpool.active++;
+	qunlock(&hpool);
 
 	if(debug)
 		fprint(2, "hdial [%d] %s\n", hpool.active, addr);