[Groonga-commit] groonga/express-kotoumi [master] Rename options: listenPort => receivePort, listenServer => receiveServer

Back to archive index

YUKI Hiroshi null+****@clear*****
Mon Jan 21 19:06:09 JST 2013


YUKI Hiroshi	2013-01-21 19:06:09 +0900 (Mon, 21 Jan 2013)

  New Revision: 9e6521af7bf7ebb7f1d92a7133c14ff31523c025
  https://github.com/groonga/express-kotoumi/commit/9e6521af7bf7ebb7f1d92a7133c14ff31523c025

  Log:
    Rename options: listenPort => receivePort, listenServer => receiveServer

  Modified files:
    lib/backend-adaptor.js
    test/backend-adaptor.test.js

  Modified: lib/backend-adaptor.js (+14 -5)
===================================================================
--- lib/backend-adaptor.js    2013-01-21 18:57:25 +0900 (06be7df)
+++ lib/backend-adaptor.js    2013-01-21 19:06:09 +0900 (cec4014)
@@ -1,8 +1,17 @@
 /**
+ * var connection = new Connection({ tag:         'groonga',
+ *                                   hostName:    'localhost',
+ *                                   port:        24224,
+ *                                   receiveHostName: 'localhost',
+ *                                   receivePort: 10030 });
+ * or
+ * var server = require('http').createServer(handler);
+ * server.listen(10030);
  * var connection = new Connection({ tag:        'groonga',
  *                                   hostName:   'localhost',
  *                                   port:       24224,
- *                                   listenPort: 10030 });
+ *                                   receiveHostName: 'localhost',
+ *                                   receiveServer:   server });
  *
  * // for REST APIs
  * connection.emitMessage(
@@ -53,14 +62,14 @@ Connection.prototype._initSender = function() {
 
 Connection.prototype._initReceiver = function() {
   this.hostName = this._params.hostName || DEFAULT_HOST_NAME;
-  this.listenPort = this._params.listenPort || DEFAULT_LISTEN_PORT;
+  this.receivePort = this._params.receivePort || DEFAULT_LISTEN_PORT;
 
   var receiver = this._params.receiver;
   if (!receiver) {
-    var server = this.listenServer;
+    var server = this.receiveServer;
     if (!server) {
       server = require('http').createServer(function() {});
-      server.listen(this.listenPort);
+      server.listen(this.receivePort);
     }
     receiver = socketIo.listen(server);
   }
@@ -103,7 +112,7 @@ Connection.prototype.emitMessage = function(type, body, callback) {
   var envelope = {
     id:         id,
     date:       getCurrentTime(),
-    replyTo:    this.hostName + ':' + this.listenPort,
+    replyTo:    this.receiveHostName + ':' + this.receivePort,
     statusCode: 200,
     type:       type,
     body:       body

  Modified: test/backend-adaptor.test.js (+1 -1)
===================================================================
--- test/backend-adaptor.test.js    2013-01-21 18:57:25 +0900 (a77a550)
+++ test/backend-adaptor.test.js    2013-01-21 19:06:09 +0900 (a1fce31)
@@ -14,7 +14,7 @@ suite('Connection', function() {
   setup(function() {
     connection = new Connection({
       tag:        'test',
-      listenPort: utils.testReceivePort,
+      receivePort: utils.testReceivePort,
       sender:     sender = utils.createMockedSender(),
       receiver:   receiver = utils.createMockedReceiver()
     });
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index