mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
Fix for "Remote host closed connection" exception
EINTR errors are recoverable, just need to read() again. Randomly while looking at files in the file browser the contents view will be empty or files will not be shown when clicking a discloser triangle. Seems to happen more when running in XCode than when running by itself.
This commit is contained in:
+8
-2
@@ -33,8 +33,14 @@
|
||||
while (n > 0) {
|
||||
n = read(fd, buffer + bytesReceived++, 1);
|
||||
|
||||
if (n < 0)
|
||||
[[NSException exceptionWithName:@"Socket error" reason:@"Remote host closed connection" userInfo:nil] raise];
|
||||
if (n < 0) {
|
||||
if (errno == EINTR) {
|
||||
n = 1;
|
||||
bytesReceived--;
|
||||
} else {
|
||||
[[NSException exceptionWithName:@"Socket error" reason:@"Remote host closed connection" userInfo:nil] raise];
|
||||
}
|
||||
}
|
||||
|
||||
if (bytesReceived >= bufferSize) {
|
||||
// Make buffer bigger
|
||||
|
||||
Reference in New Issue
Block a user