winlin

refine buffer read socket logic.

@@ -62,10 +62,10 @@ int SrsBuffer::ensure_buffer_bytes(SrsSocket* skt, int required_size) @@ -62,10 +62,10 @@ int SrsBuffer::ensure_buffer_bytes(SrsSocket* skt, int required_size)
62 { 62 {
63 int ret = ERROR_SUCCESS; 63 int ret = ERROR_SUCCESS;
64 64
65 - ssize_t nread;  
66 while (size() < required_size) { 65 while (size() < required_size) {
67 char buffer[SOCKET_READ_SIZE]; 66 char buffer[SOCKET_READ_SIZE];
68 67
  68 + ssize_t nread;
69 if ((ret = skt->read(buffer, SOCKET_READ_SIZE, &nread)) != ERROR_SUCCESS) { 69 if ((ret = skt->read(buffer, SOCKET_READ_SIZE, &nread)) != ERROR_SUCCESS) {
70 return ret; 70 return ret;
71 } 71 }