Acquire the send lock only while actually sending

Thus, we no longer hold the send lock while substituting missing paths on the build machine. This is a good thing in particular for macOS builders which have a tendency to hang forever in curl downloads.

Created by  Eelco Dolstra  on September 1, 2017
FJCKDJKBQ3KRQEAQ2GX2HIPLA3NEXBJ4BB4MA6PYDEW7ZRHWAZJQC
Change contents