Module: sip-router
Branch: master
Commit: c390fed30a67655a8d45c7210b06d82bde9f3820
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c390fed30a67655a8d45c7210b06d82bde9f3820

Author: Andrei Pelinescu-Onciul <[email protected]>
Committer: Andrei Pelinescu-Onciul <[email protected]>
Date:   Mon Sep 21 18:41:26 2009 +0200

tcp: tls fix_read_con hook return changes

tls_fix_read_con doesn't change the tcp connection state any
longer, relying instead on different return codes.

---

 tcp_read.c  |    6 +++---
 tls_hooks.h |    6 +++++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/tcp_read.c b/tcp_read.c
index 7d45d53..b79e2e2 100644
--- a/tcp_read.c
+++ b/tcp_read.c
@@ -651,11 +651,11 @@ int tcp_read_req(struct tcp_connection* con, int* 
bytes_read, int* read_flags)
                req=&con->req;
 #ifdef USE_TLS
                if (con->type==PROTO_TLS){
-                       if (tls_fix_read_conn(con)!=0){
+                       ret=tls_fix_read_conn(con);
+                       if (unlikely(ret<0)){
                                resp=CONN_ERROR;
                                goto end_req;
-                       }
-                       if (unlikely(con->state!=S_CONN_OK && 
con->state!=S_CONN_ACCEPT))
+                       }else if (unlikely(ret==0))
                                goto end_req; /* not enough data */
                }
 #endif
diff --git a/tls_hooks.h b/tls_hooks.h
index 5b17ca6..462ad3d 100644
--- a/tls_hooks.h
+++ b/tls_hooks.h
@@ -51,7 +51,11 @@ struct tls_hooks{
        /* checks if a tls connection is fully established before a read, and 
if 
         * not it runs tls_accept() or tls_connect() as needed
         * (tls_accept and tls_connect are deferred to the "reader" process for
-        *  performance reasons) */
+        *  performance reasons)
+        * returns 1 if the read can continue, 0 if the connection is not yet
+        * ready for the read and fix_read_con() should be attempted at a latter
+        * time and <0 on error.
+        */
        int (*fix_read_con)(struct tcp_connection* c);
        
        /* per listening socket init, called on ser startup (after modules,


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to