Explorar o código

BSSLConnection: we only need BPendingGroup, not BReactor

ambrop7 %!s(int64=14) %!d(string=hai) anos
pai
achega
fb7bafc5dc

+ 1 - 1
client/PasswordListener.c

@@ -148,7 +148,7 @@ void listener_handler (PasswordListener *l)
         }
         
         // initialize SSLConnection
-        BSSLConnection_Init(&client->sslcon, client->sock->ssl_prfd, 0, l->bsys, client, (BSSLConnection_handler)client_sslcon_handler);
+        BSSLConnection_Init(&client->sslcon, client->sock->ssl_prfd, 0, BReactor_PendingGroup(l->bsys), client, (BSSLConnection_handler)client_sslcon_handler);
         
         send_if = BSSLConnection_GetSendIf(&client->sslcon);
         recv_if = BSSLConnection_GetRecvIf(&client->sslcon);

+ 2 - 2
client/StreamPeerIO.c

@@ -127,7 +127,7 @@ void connector_handler (StreamPeerIO *pio, int is_error)
         }
         
         // init BSSLConnection
-        BSSLConnection_Init(&pio->connect.sslcon, pio->connect.sock.ssl_prfd, 1, pio->reactor, pio, (BSSLConnection_handler)connect_sslcon_handler);
+        BSSLConnection_Init(&pio->connect.sslcon, pio->connect.sock.ssl_prfd, 1, BReactor_PendingGroup(pio->reactor), pio, (BSSLConnection_handler)connect_sslcon_handler);
         
         // change state
         pio->connect.state = CONNECT_STATE_HANDSHAKE;
@@ -312,7 +312,7 @@ int init_io (StreamPeerIO *pio, sslsocket *sock)
     
     if (pio->ssl) {
         // init BSSLConnection
-        BSSLConnection_Init(&pio->sslcon, sock->ssl_prfd, 0, pio->reactor, pio, (BSSLConnection_handler)sslcon_handler);
+        BSSLConnection_Init(&pio->sslcon, sock->ssl_prfd, 0, BReactor_PendingGroup(pio->reactor), pio, (BSSLConnection_handler)sslcon_handler);
     } else {
         // init connection interfaces
         BConnection_SendAsync_Init(&sock->con);

+ 7 - 7
nspr_support/BSSLConnection.c

@@ -333,13 +333,13 @@ static void connection_init_job_handler (BSSLConnection *o)
 static void connection_init_up (BSSLConnection *o)
 {
     // init send interface
-    StreamPassInterface_Init(&o->send_if, (StreamPassInterface_handler_send)connection_send_if_handler_send, o, BReactor_PendingGroup(o->reactor));
+    StreamPassInterface_Init(&o->send_if, (StreamPassInterface_handler_send)connection_send_if_handler_send, o, o->pg);
     
     // init recv interface
-    StreamRecvInterface_Init(&o->recv_if, (StreamRecvInterface_handler_recv)connection_recv_if_handler_recv, o, BReactor_PendingGroup(o->reactor));
+    StreamRecvInterface_Init(&o->recv_if, (StreamRecvInterface_handler_recv)connection_recv_if_handler_recv, o, o->pg);
     
     // init recv job
-    BPending_Init(&o->recv_job, BReactor_PendingGroup(o->reactor), (BPending_handler)connection_recv_job_handler, o);
+    BPending_Init(&o->recv_job, o->pg, (BPending_handler)connection_recv_job_handler, o);
     
     // set no send data
     o->send_len = -1;
@@ -576,7 +576,7 @@ int BSSLConnection_MakeBackend (PRFileDesc *prfd, StreamPassInterface *send_if,
     return 1;
 }
 
-void BSSLConnection_Init (BSSLConnection *o, PRFileDesc *prfd, int force_handshake, BReactor *reactor, void *user,
+void BSSLConnection_Init (BSSLConnection *o, PRFileDesc *prfd, int force_handshake, BPendingGroup *pg, void *user,
                           BSSLConnection_handler handler)
 {
     ASSERT(force_handshake == 0 || force_handshake == 1)
@@ -587,7 +587,7 @@ void BSSLConnection_Init (BSSLConnection *o, PRFileDesc *prfd, int force_handsha
     
     // init arguments
     o->prfd = prfd;
-    o->reactor = reactor;
+    o->pg = pg;
     o->user = user;
     o->handler = handler;
     
@@ -598,7 +598,7 @@ void BSSLConnection_Init (BSSLConnection *o, PRFileDesc *prfd, int force_handsha
     o->have_error = 0;
     
     // init init job
-    BPending_Init(&o->init_job, BReactor_PendingGroup(o->reactor), (BPending_handler)connection_init_job_handler, o);
+    BPending_Init(&o->init_job, o->pg, (BPending_handler)connection_init_job_handler, o);
     
     if (force_handshake) {
         // set not up
@@ -614,7 +614,7 @@ void BSSLConnection_Init (BSSLConnection *o, PRFileDesc *prfd, int force_handsha
     // set backend connection
     o->backend->con = o;
     
-    DebugError_Init(&o->d_err, BReactor_PendingGroup(o->reactor));
+    DebugError_Init(&o->d_err, o->pg);
     DebugObject_Init(&o->d_obj);
 }
 

+ 3 - 3
nspr_support/BSSLConnection.h

@@ -28,7 +28,7 @@
 #include <misc/debug.h>
 #include <misc/debugerror.h>
 #include <base/DebugObject.h>
-#include <system/BReactor.h>
+#include <base/BPending.h>
 #include <flow/StreamPassInterface.h>
 #include <flow/StreamRecvInterface.h>
 
@@ -43,7 +43,7 @@ struct BSSLConnection_backend;
 
 typedef struct {
     PRFileDesc *prfd;
-    BReactor *reactor;
+    BPendingGroup *pg;
     void *user;
     BSSLConnection_handler handler;
     struct BSSLConnection_backend *backend;
@@ -77,7 +77,7 @@ struct BSSLConnection_backend {
 int BSSLConnection_GlobalInit (void) WARN_UNUSED;
 int BSSLConnection_MakeBackend (PRFileDesc *prfd, StreamPassInterface *send_if, StreamRecvInterface *recv_if) WARN_UNUSED;
 
-void BSSLConnection_Init (BSSLConnection *o, PRFileDesc *prfd, int force_handshake, BReactor *reactor, void *user,
+void BSSLConnection_Init (BSSLConnection *o, PRFileDesc *prfd, int force_handshake, BPendingGroup *pg, void *user,
                           BSSLConnection_handler handler);
 void BSSLConnection_Free (BSSLConnection *o);
 StreamPassInterface * BSSLConnection_GetSendIf (BSSLConnection *o);

+ 1 - 1
server/server.c

@@ -862,7 +862,7 @@ void listener_handler (BListener *listener)
         }
         
         // init SSL connection
-        BSSLConnection_Init(&client->sslcon, client->ssl_prfd, 1, &ss, client, (BSSLConnection_handler)client_sslcon_handler);
+        BSSLConnection_Init(&client->sslcon, client->ssl_prfd, 1, BReactor_PendingGroup(&ss), client, (BSSLConnection_handler)client_sslcon_handler);
     } else {
         // initialize I/O
         if (!client_init_io(client)) {

+ 1 - 1
server_connection/ServerConnection.c

@@ -112,7 +112,7 @@ void connector_handler (ServerConnection *o, int is_error)
         }
         
         // init BSSLConnection
-        BSSLConnection_Init(&o->sslcon, o->ssl_prfd, 0, o->reactor, o, (BSSLConnection_handler)sslcon_handler);
+        BSSLConnection_Init(&o->sslcon, o->ssl_prfd, 0, BReactor_PendingGroup(o->reactor), o, (BSSLConnection_handler)sslcon_handler);
         
         send_iface = BSSLConnection_GetSendIf(&o->sslcon);
         recv_iface = BSSLConnection_GetRecvIf(&o->sslcon);