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

Diff of /monit/socket.c

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

revision 1.9 by hauk, Wed Jul 30 01:27:15 2003 UTC revision 1.10 by hauk, Wed Jul 30 06:28:08 2003 UTC
# Line 286  const char *Socket_get_remote_hostname(S Line 286  const char *Socket_get_remote_hostname(S
286   */   */
287  int socket_print(Socket_T s, const char *m, ...) {  int socket_print(Socket_T s, const char *m, ...) {
288    
289    int rv;    int n;
290    va_list ap;    va_list ap;
291    char *buf= NULL;    char *buf= NULL;
292    
# Line 297  int socket_print(Socket_T s, const char Line 297  int socket_print(Socket_T s, const char
297    buf= format(m, ap);    buf= format(m, ap);
298    va_end(ap);    va_end(ap);
299        
300    rv= socket_write(s, buf, strlen(buf));    n= socket_write(s, buf, strlen(buf));
301    free(buf);    free(buf);
302        
303    return rv;    return n;
304    
305  }  }
306    
# Line 314  int socket_print(Socket_T s, const char Line 314  int socket_print(Socket_T s, const char
314   */   */
315  int socket_write(Socket_T s, void *b, int size) {  int socket_write(Socket_T s, void *b, int size) {
316    
317      int n= 0;
318      void *p= b;
319      
320    ASSERT(s);    ASSERT(s);
321    
322    if(s->ssl)    while(size > 0) {
323        return send_ssl_socket(s->ssl, b, size);      
324    else      if(s->ssl) {
325        return sock_write(s->socket, b, size);        n= send_ssl_socket(s->ssl, p, size);
326        } else {
327          n= sock_write(s->socket, p, size);
328        }
329    
330        if(n < 0) break;
331        p+= n;
332        size-= n;
333    
334      }
335    
336      if(n < 0) {
337        return -1;
338      }
339    
340      return p - b;
341    
342  }  }
343    

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

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