Merge branch 'stable-6.0' into stable-6.1
* stable-6.0: Fix connection leak for smart http connections Change-Id: I8b7e643b87c0f788cdafb060a2c9e8b4ef6f7375
This commit is contained in:
commit
1bd087a7f5
|
@ -1540,14 +1540,19 @@ class SmartHttpFetchConnection extends BasePackFetchConnection {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doFetch(final ProgressMonitor monitor,
|
||||
final Collection<Ref> want, final Set<ObjectId> have,
|
||||
final OutputStream outputStream) throws TransportException {
|
||||
try {
|
||||
svc = new MultiRequestService(SVC_UPLOAD_PACK,
|
||||
getProtocolVersion());
|
||||
init(svc.getInputStream(), svc.getOutputStream());
|
||||
protected void doFetch(ProgressMonitor monitor, Collection<Ref> want,
|
||||
Set<ObjectId> have, OutputStream outputStream)
|
||||
throws TransportException {
|
||||
svc = new MultiRequestService(SVC_UPLOAD_PACK,
|
||||
getProtocolVersion());
|
||||
try (InputStream svcIn = svc.getInputStream();
|
||||
OutputStream svcOut = svc.getOutputStream()) {
|
||||
init(svcIn, svcOut);
|
||||
super.doFetch(monitor, want, have, outputStream);
|
||||
} catch (TransportException e) {
|
||||
throw e;
|
||||
} catch (IOException e) {
|
||||
throw new TransportException(e.getMessage(), e);
|
||||
} finally {
|
||||
svc = null;
|
||||
}
|
||||
|
@ -1571,13 +1576,20 @@ class SmartHttpPushConnection extends BasePackPushConnection {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doPush(final ProgressMonitor monitor,
|
||||
final Map<String, RemoteRefUpdate> refUpdates,
|
||||
protected void doPush(ProgressMonitor monitor,
|
||||
Map<String, RemoteRefUpdate> refUpdates,
|
||||
OutputStream outputStream) throws TransportException {
|
||||
final Service svc = new MultiRequestService(SVC_RECEIVE_PACK,
|
||||
Service svc = new MultiRequestService(SVC_RECEIVE_PACK,
|
||||
getProtocolVersion());
|
||||
init(svc.getInputStream(), svc.getOutputStream());
|
||||
super.doPush(monitor, refUpdates, outputStream);
|
||||
try (InputStream svcIn = svc.getInputStream();
|
||||
OutputStream svcOut = svc.getOutputStream()) {
|
||||
init(svcIn, svcOut);
|
||||
super.doPush(monitor, refUpdates, outputStream);
|
||||
} catch (TransportException e) {
|
||||
throw e;
|
||||
} catch (IOException e) {
|
||||
throw new TransportException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue