/[monit]/monit/socket.c
ViewVC logotype

Diff of /monit/socket.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.24 by martinp, Wed Sep 10 16:15:30 2003 UTC revision 1.25 by hauk, Thu Sep 18 15:50:34 2003 UTC
# Line 328  int socket_print(Socket_T S, const char Line 328  int socket_print(Socket_T S, const char
328  int socket_write(Socket_T S, void *b, int size) {  int socket_write(Socket_T S, void *b, int size) {
329    
330    int n= 0;    int n= 0;
331    char *p= b;    void *p= b;
332        
333    ASSERT(S);    ASSERT(S);
334    
335    while(size > 0) {    while(size > 0) {
336            
337      if(S->ssl) {      if(S->ssl) {
338        n= send_ssl_socket(S->ssl, (void *) p, size);        n= send_ssl_socket(S->ssl, p, size);
339      } else {      } else {
340        n= sock_write(S->socket,  (void *) p, size);        n= sock_write(S->socket,  p, size);
341      }      }
342    
343      if(n <= 0) break;      if(n <= 0) break;
# Line 366  int socket_write(Socket_T S, void *b, in Line 366  int socket_write(Socket_T S, void *b, in
366  int socket_read(Socket_T S, void *b, int size) {  int socket_read(Socket_T S, void *b, int size) {
367    
368    int n= 0;    int n= 0;
369    char *p= b;    void *p= b;
370    int timeout= 0;    int timeout= 0;
371        
372    ASSERT(S);    ASSERT(S);
373        
374    timeout= S->timeout;    timeout= S->timeout;
375        
376    do {    while(size > 0) {
377      if(S->ssl) {      if(S->ssl) {
378        n= recv_ssl_socket(S->ssl, (void *) p, size, timeout);        n= recv_ssl_socket(S->ssl, p, size, timeout);
379      } else {      } else {
380        n= sock_read(S->socket, (void *) p, size, timeout);        n= sock_read(S->socket, p, size, timeout);
381      }      }
382      if(n <= 0) break;      if(n <= 0) break;
383      p+= n;      p+= n;
# Line 386  int socket_read(Socket_T S, void *b, int Line 386  int socket_read(Socket_T S, void *b, int
386       * available data, otherwise we return with what we have read       * available data, otherwise we return with what we have read
387       */       */
388      timeout= 0;      timeout= 0;
389    } while(size > 0);    }
390    
391    if(n < 0 && p==b) {    if(n < 0 && p==b) {
392      return -1;      return -1;

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26