)]}'
{
  "commit": "2be97a78a958ba8f01de25e5e5850510d0e3233a",
  "tree": "b95cc25012dec16355accb7f1b79ea99c20c7df3",
  "parents": [
    "4787ba2470fd50fa5771320d2f89a93326eb718e"
  ],
  "author": {
    "name": "lpleahy",
    "email": "lpleahy@6f19259b-4bc3-4df7-8a09-765794883524",
    "time": "Thu Apr 05 22:26:43 2012 +0000"
  },
  "committer": {
    "name": "lpleahy",
    "email": "lpleahy@6f19259b-4bc3-4df7-8a09-765794883524",
    "time": "Thu Apr 05 22:26:43 2012 +0000"
  },
  "message": "Fix the issues in sockets with the BSD shutdown API.  Note that HSD 207267 is filed against TCP which aborts the receive operations early preventing the remote system to send data after transmit shutdown has occurred on the local system.  Note that the local system notifies the remote system of the transmit shutdown by sending the FIN flag!\n\nSigned-off-by: lpleahy\n\nWhen running the test program below on two Windows machines and capturing the network trace with NetMon or WireShark, the trace indicates that the client system sends the FIN flag to the server, the server responds with the final data packet (\"OK\\n\") before closing the connection by sending a packet with the FIN and ACK flags set.\n\nTest program (ThroughPut.py):\n\n#! /usr/bin/env python\n\n# Test network throughput.\n#\n# Usage:\n# 1) on host_A: throughput -s [port]                    # start a server\n# 2) on host_B: throughput -c  count host_A [port]      # start a client\n#\n# The server will service multiple clients until it is killed.\n#\n# The client performs one transfer of count*BUFSIZE bytes and\n# measures the time it takes (roundtrip!).\n\n\nimport sys, time\nfrom socket import *\n\nMY_PORT \u003d 50000 + 42\n\nBUFSIZE \u003d 1024\n\n\ndef main():\n    if len(sys.argv) \u003c 2:\n        usage()\n    if sys.argv[1] \u003d\u003d \u0027-s\u0027:\n        server()\n    elif sys.argv[1] \u003d\u003d \u0027-c\u0027:\n        client()\n    else:\n        usage()\n\n\ndef usage():\n    sys.stdout \u003d sys.stderr\n    print \u0027Usage:    (on host_A) throughput -s [port]\u0027\n    print \u0027and then: (on host_B) throughput -c count host_A [port]\u0027\n    sys.exit(2)\n\n\ndef server():\n    if len(sys.argv) \u003e 2:\n        port \u003d eval(sys.argv[2])\n    else:\n        port \u003d MY_PORT\n    s \u003d socket(AF_INET, SOCK_STREAM)\n    s.bind((\u0027\u0027, port))\n    s.listen(1)\n    print \u0027Server ready...\u0027\n    while 1:\n        conn, (host, remoteport) \u003d s.accept()\n        while 1:\n            data \u003d conn.recv(BUFSIZE)\n            if not data:\n                break\n            del data\n        conn.send(\u0027OK\\n\u0027)\n        conn.close()\n        print \u0027Done with\u0027, host, \u0027port\u0027, remoteport\n\n\ndef client():\n    if len(sys.argv) \u003c 4:\n        usage()\n    count \u003d int(eval(sys.argv[2]))\n    host \u003d sys.argv[3]\n    if len(sys.argv) \u003e 4:\n        port \u003d eval(sys.argv[4])\n    else:\n        port \u003d MY_PORT\n    testdata \u003d \u0027x\u0027 * (BUFSIZE-1) + \u0027\\n\u0027\n    t1 \u003d time.time()\n    s \u003d socket(AF_INET, SOCK_STREAM)\n    t2 \u003d time.time()\n    s.connect((host, port))\n    t3 \u003d time.time()\n    i \u003d 0\n    while i \u003c count:\n        i \u003d i+1\n        s.send(testdata)\n    s.shutdown(1) # Send EOF\n    t4 \u003d time.time()\n    data \u003d s.recv(BUFSIZE)\n    t5 \u003d time.time()\n    print data\n    print \u0027Raw timers:\u0027, t1, t2, t3, t4, t5\n    print \u0027Intervals:\u0027, t2-t1, t3-t2, t4-t3, t5-t4\n    print \u0027Total:\u0027, t5-t1\n    print \u0027Throughput:\u0027, round((BUFSIZE*count*0.001) / (t5-t1), 3),\n    print \u0027K/sec.\u0027\n\n\nmain()\n\n\ngit-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/branches/SocketDev@13164 6f19259b-4bc3-4df7-8a09-765794883524\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "acb23677aa6a8650c8c88910f57764ee2282555e",
      "old_mode": 33188,
      "old_path": "StdLib/EfiSocketLib/Socket.c",
      "new_id": "a609b70959814e4b57f0fa87d7e7036496c72555",
      "new_mode": 33188,
      "new_path": "StdLib/EfiSocketLib/Socket.c"
    },
    {
      "type": "modify",
      "old_id": "f2fbdb57b374043c5c25163a3b24008bacc046cc",
      "old_mode": 33188,
      "old_path": "StdLib/EfiSocketLib/Socket.h",
      "new_id": "7372ec2ee1ee4741416f2a49e53f90867edbbac2",
      "new_mode": 33188,
      "new_path": "StdLib/EfiSocketLib/Socket.h"
    }
  ]
}
