@@ -233,18 +233,9 @@ CloudI.API = function API (thread_index, callback) {
233233 else {
234234 throw new InvalidInputException ( ) ;
235235 }
236- if ( Erlang . nodejs_version_after ( '0.12.1' , false ) ) {
237- API . _s_in = new net . Socket ( { fd : ( thread_index + 3 ) ,
238- readable : true ,
239- writable : true } ) ;
240- API . _s_out = API . _s_in ;
241- }
242- else {
243- API . _s_in = new net . Socket ( { fd : ( thread_index + 3 ) ,
244- readable : true ,
245- writable : false } ) ;
246- API . _s_out = fs . createWriteStream ( null , { fd : ( thread_index + 3 ) } ) ;
247- }
236+ API . _socket = new net . Socket ( { fd : ( thread_index + 3 ) ,
237+ readable : true ,
238+ writable : true } ) ;
248239 API . _initialization_complete = false ;
249240 API . _terminate = false ;
250241 API . _terminate_callback = undefined ;
@@ -255,7 +246,7 @@ CloudI.API = function API (thread_index, callback) {
255246 API . _poll_callbacks_pending = [ ] ;
256247 API . _poll_data = undefined ;
257248 API . _poll_data_size = undefined ;
258- API . _s_in . on ( 'data' , function ( data ) {
249+ API . _socket . on ( 'data' , function ( data ) {
259250 try {
260251 if ( ! API . _use_header ) {
261252 API . _poll_request ( data ) ;
@@ -299,7 +290,7 @@ CloudI.API = function API (thread_index, callback) {
299290 }
300291 }
301292 } ) ;
302- API . _s_in . on ( 'error' , function ( err ) {
293+ API . _socket . on ( 'error' , function ( err ) {
303294 API . _exception ( err ) ;
304295 API . _poll_terminate ( ) ;
305296 } ) ;
@@ -1012,7 +1003,7 @@ CloudI.API.prototype._poll_wait = function (f) {
10121003CloudI . API . prototype . _poll_terminate = function ( ) {
10131004 var API = this ;
10141005 API . _terminate = true ;
1015- API . _s_in . destroy ( ) ;
1006+ API . _socket . destroy ( ) ;
10161007 if ( API . _terminate_callback !== undefined ) {
10171008 API . _terminate_callback ( false ) ;
10181009 }
@@ -1157,7 +1148,7 @@ CloudI.API.prototype._send = function (terms) {
11571148 if ( API . _use_header ) {
11581149 data = Buffer . concat ( [ packUint32big ( data . length ) , data ] ) ;
11591150 }
1160- API . _s_out . write ( data , 'binary' ) ;
1151+ API . _socket . write ( data , 'binary' ) ;
11611152 } ) ;
11621153} ;
11631154
0 commit comments