| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <dirent.h> | 5 #include <dirent.h> |
| 6 #include <netinet/tcp.h> // For TCP_NODELAY | 6 #include <netinet/tcp.h> // For TCP_NODELAY |
| 7 #include <sys/socket.h> | 7 #include <sys/socket.h> |
| 8 #include <sys/types.h> | 8 #include <sys/types.h> |
| 9 #include <sys/file.h> | 9 #include <sys/file.h> |
| 10 #include <sys/stat.h> | 10 #include <sys/stat.h> |
| (...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 if (bytes_read < 0) { | 1118 if (bytes_read < 0) { |
| 1119 switch(SSL_get_error(ssl_, bytes_read)) { | 1119 switch(SSL_get_error(ssl_, bytes_read)) { |
| 1120 case SSL_ERROR_WANT_READ: | 1120 case SSL_ERROR_WANT_READ: |
| 1121 case SSL_ERROR_WANT_WRITE: | 1121 case SSL_ERROR_WANT_WRITE: |
| 1122 case SSL_ERROR_WANT_ACCEPT: | 1122 case SSL_ERROR_WANT_ACCEPT: |
| 1123 case SSL_ERROR_WANT_CONNECT: | 1123 case SSL_ERROR_WANT_CONNECT: |
| 1124 events_ &= ~EPOLLIN; | 1124 events_ &= ~EPOLLIN; |
| 1125 goto done; | 1125 goto done; |
| 1126 default: | 1126 default: |
| 1127 PrintSslError(); | 1127 PrintSslError(); |
| 1128 break; | 1128 goto error_or_close; |
| 1129 } | 1129 } |
| 1130 } | 1130 } |
| 1131 } else { | 1131 } else { |
| 1132 bytes_read = recv(fd_, bytes, size, MSG_DONTWAIT); | 1132 bytes_read = recv(fd_, bytes, size, MSG_DONTWAIT); |
| 1133 } | 1133 } |
| 1134 int stored_errno = errno; | 1134 int stored_errno = errno; |
| 1135 if (bytes_read == -1) { | 1135 if (bytes_read == -1) { |
| 1136 switch (stored_errno) { | 1136 switch (stored_errno) { |
| 1137 case EAGAIN: | 1137 case EAGAIN: |
| 1138 events_ &= ~EPOLLIN; | 1138 events_ &= ~EPOLLIN; |
| (...skipping 2230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3369 } | 3369 } |
| 3370 break; | 3370 break; |
| 3371 } | 3371 } |
| 3372 usleep(1000*10); // 10 ms | 3372 usleep(1000*10); // 10 ms |
| 3373 } | 3373 } |
| 3374 | 3374 |
| 3375 unlink(PIDFILE); | 3375 unlink(PIDFILE); |
| 3376 close(pidfile_fd); | 3376 close(pidfile_fd); |
| 3377 return 0; | 3377 return 0; |
| 3378 } | 3378 } |
| OLD | NEW |