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

Diff of /monit/socket.c

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

revision 1.19 by rory, Wed Aug 13 00:45:15 2003 UTC revision 1.20 by chopp, Wed Sep 3 15:29:29 2003 UTC
# Line 324  int socket_print(Socket_T S, const char Line 324  int socket_print(Socket_T S, const char
324  int socket_write(Socket_T S, void *b, int size) {  int socket_write(Socket_T S, void *b, int size) {
325    
326    int n= 0;    int n= 0;
327    void *p= b;    char *p= b;
328        
329    ASSERT(S);    ASSERT(S);
330    
331    while(size > 0) {    while(size > 0) {
332            
333      if(S->ssl) {      if(S->ssl) {
334        n= send_ssl_socket(S->ssl, p, size);        n= send_ssl_socket(S->ssl, (void *) p, size);
335      } else {      } else {
336        n= sock_write(S->socket, p, size);        n= sock_write(S->socket,  (void *) p, size);
337      }      }
338    
339      if(n <= 0) break;      if(n <= 0) break;
# Line 347  int socket_write(Socket_T S, void *b, in Line 347  int socket_write(Socket_T S, void *b, in
347      return -1;      return -1;
348    }    }
349        
350    return p - b;    return  (int) p - (int) b;
351    
352  }  }
353    
# Line 362  int socket_write(Socket_T S, void *b, in Line 362  int socket_write(Socket_T S, void *b, in
362  int socket_read(Socket_T S, void *b, int size) {  int socket_read(Socket_T S, void *b, int size) {
363    
364    int n= 0;    int n= 0;
365    void *p= b;    char *p= b;
366    int timeout= 0;    int timeout= 0;
367        
368    ASSERT(S);    ASSERT(S);
# Line 371  int socket_read(Socket_T S, void *b, int Line 371  int socket_read(Socket_T S, void *b, int
371        
372    do {    do {
373      if(S->ssl) {      if(S->ssl) {
374        n= recv_ssl_socket(S->ssl, p, size, timeout);        n= recv_ssl_socket(S->ssl, (void *) p, size, timeout);
375      } else {      } else {
376        n= sock_read(S->socket, p, size, timeout);        n= sock_read(S->socket, (void *) p, size, timeout);
377      }      }
378      if(n <= 0) break;      if(n <= 0) break;
379      p+= n;      p+= n;
# Line 388  int socket_read(Socket_T S, void *b, int Line 388  int socket_read(Socket_T S, void *b, int
388      return -1;      return -1;
389    }    }
390        
391    return p - b;    return (int) p - (int) b;
392    
393  }  }
394    

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

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