[svn-commits] qwell: branch qwell/fun_with_transports r388216 - /team/qwell/fun_with_transp...
    SVN commits to the Digium repositories 
    svn-commits at lists.digium.com
       
    Thu May  9 15:07:21 CDT 2013
    
    
  
Author: qwell
Date: Thu May  9 15:07:19 2013
New Revision: 388216
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=388216
Log:
Get rid of an allocation that happened on every read.
Modified:
    team/qwell/fun_with_transports/res/res_sip_transport_websocket.c
Modified: team/qwell/fun_with_transports/res/res_sip_transport_websocket.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/res/res_sip_transport_websocket.c?view=diff&rev=388216&r1=388215&r2=388216
==============================================================================
--- team/qwell/fun_with_transports/res/res_sip_transport_websocket.c (original)
+++ team/qwell/fun_with_transports/res/res_sip_transport_websocket.c Thu May  9 15:07:19 2013
@@ -46,6 +46,7 @@
  */
 struct ws_transport {
 	pjsip_transport transport;
+	pjsip_rx_data rdata;
 	struct ast_websocket *ws_session;
 };
 
@@ -185,14 +186,9 @@
 	struct ws_transport *newtransport = read_data->transport;
 	struct ast_websocket *session = newtransport->ws_session;
 
-	pjsip_rx_data *rdata;
+	pjsip_rx_data *rdata = &newtransport->rdata;
 	int recvd;
 	pj_str_t buf;
-
-	if (!(rdata = PJ_POOL_ZALLOC_T(newtransport->transport.pool, pjsip_rx_data))) {
-		ast_log(LOG_ERROR, "Failed to allocate WebSocket endpoint pool.\n");
-		return -1;
-	}
 
 	rdata->tp_info.pool = newtransport->transport.pool;
 	rdata->tp_info.transport = &newtransport->transport;
    
    
More information about the svn-commits
mailing list