Merge pull request #1358 from shlevy/store-nesting
Add Store nesting to fix import-from-derivation within filterSource
This commit is contained in:
		
						commit
						39b08f4c0c
					
				
					 2 changed files with 18 additions and 0 deletions
				
			
		| 
						 | 
					@ -414,7 +414,9 @@ Path RemoteStore::addToStore(const string & name, const Path & _srcPath,
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
        conn->to.written = 0;
 | 
					        conn->to.written = 0;
 | 
				
			||||||
        conn->to.warn = true;
 | 
					        conn->to.warn = true;
 | 
				
			||||||
 | 
					        connections->incCapacity();
 | 
				
			||||||
        dumpPath(srcPath, conn->to, filter);
 | 
					        dumpPath(srcPath, conn->to, filter);
 | 
				
			||||||
 | 
					        connections->decCapacity();
 | 
				
			||||||
        conn->to.warn = false;
 | 
					        conn->to.warn = false;
 | 
				
			||||||
        conn->processStderr();
 | 
					        conn->processStderr();
 | 
				
			||||||
    } catch (SysError & e) {
 | 
					    } catch (SysError & e) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -68,6 +68,22 @@ public:
 | 
				
			||||||
        state_->max = max;
 | 
					        state_->max = max;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void incCapacity()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        auto state_(state.lock());
 | 
				
			||||||
 | 
					        state_->max++;
 | 
				
			||||||
 | 
					        /* we could wakeup here, but this is only used when we're
 | 
				
			||||||
 | 
					         * about to nest Pool usages, and we want to save the slot for
 | 
				
			||||||
 | 
					         * the nested use if we can
 | 
				
			||||||
 | 
					         */
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void decCapacity()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        auto state_(state.lock());
 | 
				
			||||||
 | 
					        state_->max--;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ~Pool()
 | 
					    ~Pool()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        auto state_(state.lock());
 | 
					        auto state_(state.lock());
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue