ofs | hex dump | ascii |
---|
0000 | 03 f3 0d 0a c9 6d e2 53 63 00 00 00 00 00 00 00 00 03 00 00 00 40 00 00 00 73 3d 00 00 00 64 00 | .....m.Sc............@...s=...d. |
0020 | 00 64 01 00 6c 00 00 5a 00 00 64 02 00 5a 01 00 64 03 00 5a 02 00 65 00 00 6a 03 00 65 00 00 6a | .d..l..Z..d..Z..d..Z..e..j..e..j |
0040 | 04 00 64 04 00 84 02 00 5a 05 00 65 01 00 64 05 00 84 01 00 5a 06 00 64 01 00 53 28 06 00 00 00 | ..d.....Z..e..d.....Z..d..S(.... |
0060 | 69 ff ff ff ff 4e 73 09 00 00 00 31 32 37 2e 30 2e 30 2e 31 73 03 00 00 00 3a 3a 31 63 02 00 00 | i....Ns....127.0.0.1s....::1c... |
0080 | 00 04 00 00 00 03 00 00 00 43 00 00 00 73 2f 00 00 00 74 00 00 6a 00 00 7c 00 00 7c 01 00 83 02 | .........C...s/...t..j..|..|.... |
00a0 | 00 7d 02 00 74 01 00 7c 02 00 83 01 00 7d 03 00 7c 02 00 6a 02 00 83 00 00 01 7e 02 00 7c 03 00 | .}..t..|.....}..|..j......~..|.. |
00c0 | 53 28 01 00 00 00 73 ee 0d 00 00 52 65 74 75 72 6e 73 20 61 6e 20 75 6e 75 73 65 64 20 70 6f 72 | S(....s....Returns.an.unused.por |
00e0 | 74 20 74 68 61 74 20 73 68 6f 75 6c 64 20 62 65 20 73 75 69 74 61 62 6c 65 20 66 6f 72 20 62 69 | t.that.should.be.suitable.for.bi |
0100 | 6e 64 69 6e 67 2e 20 20 54 68 69 73 20 69 73 0a 20 20 20 20 61 63 68 69 65 76 65 64 20 62 79 20 | nding...This.is.....achieved.by. |
0120 | 63 72 65 61 74 69 6e 67 20 61 20 74 65 6d 70 6f 72 61 72 79 20 73 6f 63 6b 65 74 20 77 69 74 68 | creating.a.temporary.socket.with |
0140 | 20 74 68 65 20 73 61 6d 65 20 66 61 6d 69 6c 79 20 61 6e 64 20 74 79 70 65 20 61 73 0a 20 20 20 | .the.same.family.and.type.as.... |
0160 | 20 74 68 65 20 27 73 6f 63 6b 27 20 70 61 72 61 6d 65 74 65 72 20 28 64 65 66 61 75 6c 74 20 69 | .the.'sock'.parameter.(default.i |
0180 | 73 20 41 46 5f 49 4e 45 54 2c 20 53 4f 43 4b 5f 53 54 52 45 41 4d 29 2c 20 61 6e 64 20 62 69 6e | s.AF_INET,.SOCK_STREAM),.and.bin |
01a0 | 64 69 6e 67 20 69 74 20 74 6f 0a 20 20 20 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 68 6f 73 | ding.it.to.....the.specified.hos |
01c0 | 74 20 61 64 64 72 65 73 73 20 28 64 65 66 61 75 6c 74 73 20 74 6f 20 30 2e 30 2e 30 2e 30 29 20 | t.address.(defaults.to.0.0.0.0). |
01e0 | 77 69 74 68 20 74 68 65 20 70 6f 72 74 20 73 65 74 20 74 6f 20 30 2c 0a 20 20 20 20 65 6c 69 63 | with.the.port.set.to.0,.....elic |
0200 | 69 74 69 6e 67 20 61 6e 20 75 6e 75 73 65 64 20 65 70 68 65 6d 65 72 61 6c 20 70 6f 72 74 20 66 | iting.an.unused.ephemeral.port.f |
0220 | 72 6f 6d 20 74 68 65 20 4f 53 2e 20 20 54 68 65 20 74 65 6d 70 6f 72 61 72 79 20 73 6f 63 6b 65 | rom.the.OS...The.temporary.socke |
0240 | 74 20 69 73 0a 20 20 20 20 74 68 65 6e 20 63 6c 6f 73 65 64 20 61 6e 64 20 64 65 6c 65 74 65 64 | t.is.....then.closed.and.deleted |
0260 | 2c 20 61 6e 64 20 74 68 65 20 65 70 68 65 6d 65 72 61 6c 20 70 6f 72 74 20 69 73 20 72 65 74 75 | ,.and.the.ephemeral.port.is.retu |
0280 | 72 6e 65 64 2e 0a 0a 20 20 20 20 45 69 74 68 65 72 20 74 68 69 73 20 6d 65 74 68 6f 64 20 6f 72 | rned.......Either.this.method.or |
02a0 | 20 62 69 6e 64 5f 70 6f 72 74 28 29 20 73 68 6f 75 6c 64 20 62 65 20 75 73 65 64 20 66 6f 72 20 | .bind_port().should.be.used.for. |
02c0 | 61 6e 79 20 74 65 73 74 73 20 77 68 65 72 65 20 61 0a 20 20 20 20 73 65 72 76 65 72 20 73 6f 63 | any.tests.where.a.....server.soc |
02e0 | 6b 65 74 20 6e 65 65 64 73 20 74 6f 20 62 65 20 62 6f 75 6e 64 20 74 6f 20 61 20 70 61 72 74 69 | ket.needs.to.be.bound.to.a.parti |
0300 | 63 75 6c 61 72 20 70 6f 72 74 20 66 6f 72 20 74 68 65 20 64 75 72 61 74 69 6f 6e 20 6f 66 0a 20 | cular.port.for.the.duration.of.. |
0320 | 20 20 20 74 68 65 20 74 65 73 74 2e 20 20 57 68 69 63 68 20 6f 6e 65 20 74 6f 20 75 73 65 20 64 | ...the.test...Which.one.to.use.d |
0340 | 65 70 65 6e 64 73 20 6f 6e 20 77 68 65 74 68 65 72 20 74 68 65 20 63 61 6c 6c 69 6e 67 20 63 6f | epends.on.whether.the.calling.co |
0360 | 64 65 20 69 73 20 63 72 65 61 74 69 6e 67 0a 20 20 20 20 61 20 70 79 74 68 6f 6e 20 73 6f 63 6b | de.is.creating.....a.python.sock |
0380 | 65 74 2c 20 6f 72 20 69 66 20 61 6e 20 75 6e 75 73 65 64 20 70 6f 72 74 20 6e 65 65 64 73 20 74 | et,.or.if.an.unused.port.needs.t |
03a0 | 6f 20 62 65 20 70 72 6f 76 69 64 65 64 20 69 6e 20 61 20 63 6f 6e 73 74 72 75 63 74 6f 72 0a 20 | o.be.provided.in.a.constructor.. |
03c0 | 20 20 20 6f 72 20 70 61 73 73 65 64 20 74 6f 20 61 6e 20 65 78 74 65 72 6e 61 6c 20 70 72 6f 67 | ...or.passed.to.an.external.prog |
03e0 | 72 61 6d 20 28 69 2e 65 2e 20 74 68 65 20 2d 61 63 63 65 70 74 20 61 72 67 75 6d 65 6e 74 20 74 | ram.(i.e..the.-accept.argument.t |
0400 | 6f 20 6f 70 65 6e 73 73 6c 27 73 0a 20 20 20 20 73 5f 73 65 72 76 65 72 20 6d 6f 64 65 29 2e 20 | o.openssl's.....s_server.mode).. |
0420 | 20 41 6c 77 61 79 73 20 70 72 65 66 65 72 20 62 69 6e 64 5f 70 6f 72 74 28 29 20 6f 76 65 72 20 | .Always.prefer.bind_port().over. |
0440 | 66 69 6e 64 5f 75 6e 75 73 65 64 5f 70 6f 72 74 28 29 20 77 68 65 72 65 0a 20 20 20 20 70 6f 73 | find_unused_port().where.....pos |
0460 | 73 69 62 6c 65 2e 20 20 48 61 72 64 20 63 6f 64 65 64 20 70 6f 72 74 73 20 73 68 6f 75 6c 64 20 | sible...Hard.coded.ports.should. |
0480 | 2a 4e 45 56 45 52 2a 20 62 65 20 75 73 65 64 2e 20 20 41 73 20 73 6f 6f 6e 20 61 73 20 61 20 73 | *NEVER*.be.used...As.soon.as.a.s |
04a0 | 65 72 76 65 72 0a 20 20 20 20 73 6f 63 6b 65 74 20 69 73 20 62 6f 75 6e 64 20 74 6f 20 61 20 68 | erver.....socket.is.bound.to.a.h |
04c0 | 61 72 64 20 63 6f 64 65 64 20 70 6f 72 74 2c 20 74 68 65 20 61 62 69 6c 69 74 79 20 74 6f 20 72 | ard.coded.port,.the.ability.to.r |
04e0 | 75 6e 20 6d 75 6c 74 69 70 6c 65 20 69 6e 73 74 61 6e 63 65 73 0a 20 20 20 20 6f 66 20 74 68 65 | un.multiple.instances.....of.the |
0500 | 20 74 65 73 74 20 73 69 6d 75 6c 74 61 6e 65 6f 75 73 6c 79 20 6f 6e 20 74 68 65 20 73 61 6d 65 | .test.simultaneously.on.the.same |
0520 | 20 68 6f 73 74 20 69 73 20 63 6f 6d 70 72 6f 6d 69 73 65 64 2c 20 77 68 69 63 68 20 6d 61 6b 65 | .host.is.compromised,.which.make |
0540 | 73 20 74 68 65 0a 20 20 20 20 74 65 73 74 20 61 20 74 69 63 6b 69 6e 67 20 74 69 6d 65 20 62 6f | s.the.....test.a.ticking.time.bo |
0560 | 6d 62 20 69 6e 20 61 20 62 75 69 6c 64 62 6f 74 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 20 4f 6e | mb.in.a.buildbot.environment..On |
0580 | 20 55 6e 69 78 20 62 75 69 6c 64 62 6f 74 73 2c 20 74 68 69 73 0a 20 20 20 20 6d 61 79 20 73 69 | .Unix.buildbots,.this.....may.si |
05a0 | 6d 70 6c 79 20 6d 61 6e 69 66 65 73 74 20 61 73 20 61 20 66 61 69 6c 65 64 20 74 65 73 74 2c 20 | mply.manifest.as.a.failed.test,. |
05c0 | 77 68 69 63 68 20 63 61 6e 20 62 65 20 72 65 63 6f 76 65 72 65 64 20 66 72 6f 6d 20 77 69 74 68 | which.can.be.recovered.from.with |
05e0 | 6f 75 74 0a 20 20 20 20 69 6e 74 65 72 76 65 6e 74 69 6f 6e 20 69 6e 20 6d 6f 73 74 20 63 61 73 | out.....intervention.in.most.cas |
0600 | 65 73 2c 20 62 75 74 20 6f 6e 20 57 69 6e 64 6f 77 73 2c 20 74 68 65 20 65 6e 74 69 72 65 20 70 | es,.but.on.Windows,.the.entire.p |
0620 | 79 74 68 6f 6e 20 70 72 6f 63 65 73 73 20 63 61 6e 0a 20 20 20 20 63 6f 6d 70 6c 65 74 65 6c 79 | ython.process.can.....completely |
0640 | 20 61 6e 64 20 75 74 74 65 72 6c 79 20 77 65 64 67 65 2c 20 72 65 71 75 69 72 69 6e 67 20 73 6f | .and.utterly.wedge,.requiring.so |
0660 | 6d 65 6f 6e 65 20 74 6f 20 6c 6f 67 20 69 6e 20 74 6f 20 74 68 65 20 62 75 69 6c 64 62 6f 74 0a | meone.to.log.in.to.the.buildbot. |
0680 | 20 20 20 20 61 6e 64 20 6d 61 6e 75 61 6c 6c 79 20 6b 69 6c 6c 20 74 68 65 20 61 66 66 65 63 74 | ....and.manually.kill.the.affect |
06a0 | 65 64 20 70 72 6f 63 65 73 73 2e 0a 0a 20 20 20 20 28 54 68 69 73 20 69 73 20 65 61 73 79 20 74 | ed.process.......(This.is.easy.t |
06c0 | 6f 20 72 65 70 72 6f 64 75 63 65 20 6f 6e 20 57 69 6e 64 6f 77 73 2c 20 75 6e 66 6f 72 74 75 6e | o.reproduce.on.Windows,.unfortun |
06e0 | 61 74 65 6c 79 2c 20 61 6e 64 20 63 61 6e 20 62 65 20 74 72 61 63 65 64 20 74 6f 0a 20 20 20 20 | ately,.and.can.be.traced.to..... |
0700 | 74 68 65 20 53 4f 5f 52 45 55 53 45 41 44 44 52 20 73 6f 63 6b 65 74 20 6f 70 74 69 6f 6e 20 68 | the.SO_REUSEADDR.socket.option.h |
0720 | 61 76 69 6e 67 20 64 69 66 66 65 72 65 6e 74 20 73 65 6d 61 6e 74 69 63 73 20 6f 6e 20 57 69 6e | aving.different.semantics.on.Win |
0740 | 64 6f 77 73 20 76 65 72 73 75 73 0a 20 20 20 20 55 6e 69 78 2f 4c 69 6e 75 78 2e 20 20 4f 6e 20 | dows.versus.....Unix/Linux...On. |
0760 | 55 6e 69 78 2c 20 79 6f 75 20 63 61 6e 27 74 20 68 61 76 65 20 74 77 6f 20 41 46 5f 49 4e 45 54 | Unix,.you.can't.have.two.AF_INET |
0780 | 20 53 4f 43 4b 5f 53 54 52 45 41 4d 20 73 6f 63 6b 65 74 73 20 62 69 6e 64 2c 0a 20 20 20 20 6c | .SOCK_STREAM.sockets.bind,.....l |
07a0 | 69 73 74 65 6e 20 61 6e 64 20 74 68 65 6e 20 61 63 63 65 70 74 20 63 6f 6e 6e 65 63 74 69 6f 6e | isten.and.then.accept.connection |
07c0 | 73 20 6f 6e 20 69 64 65 6e 74 69 63 61 6c 20 68 6f 73 74 2f 70 6f 72 74 73 2e 20 20 41 6e 20 45 | s.on.identical.host/ports...An.E |
07e0 | 41 44 44 52 49 4e 55 53 45 0a 20 20 20 20 73 6f 63 6b 65 74 2e 65 72 72 6f 72 20 77 69 6c 6c 20 | ADDRINUSE.....socket.error.will. |
0800 | 62 65 20 72 61 69 73 65 64 20 61 74 20 73 6f 6d 65 20 70 6f 69 6e 74 20 28 64 65 70 65 6e 64 69 | be.raised.at.some.point.(dependi |
0820 | 6e 67 20 6f 6e 20 74 68 65 20 70 6c 61 74 66 6f 72 6d 20 61 6e 64 0a 20 20 20 20 74 68 65 20 6f | ng.on.the.platform.and.....the.o |
0840 | 72 64 65 72 20 62 69 6e 64 20 61 6e 64 20 6c 69 73 74 65 6e 20 77 65 72 65 20 63 61 6c 6c 65 64 | rder.bind.and.listen.were.called |
0860 | 20 6f 6e 20 65 61 63 68 20 73 6f 63 6b 65 74 29 2e 0a 0a 20 20 20 20 48 6f 77 65 76 65 72 2c 20 | .on.each.socket).......However,. |
0880 | 6f 6e 20 57 69 6e 64 6f 77 73 2c 20 69 66 20 53 4f 5f 52 45 55 53 45 41 44 44 52 20 69 73 20 73 | on.Windows,.if.SO_REUSEADDR.is.s |
08a0 | 65 74 20 6f 6e 20 74 68 65 20 73 6f 63 6b 65 74 73 2c 20 6e 6f 20 45 41 44 44 52 49 4e 55 53 45 | et.on.the.sockets,.no.EADDRINUSE |
08c0 | 0a 20 20 20 20 77 69 6c 6c 20 65 76 65 72 20 62 65 20 72 61 69 73 65 64 20 77 68 65 6e 20 61 74 | .....will.ever.be.raised.when.at |
08e0 | 74 65 6d 70 74 69 6e 67 20 74 6f 20 62 69 6e 64 20 74 77 6f 20 69 64 65 6e 74 69 63 61 6c 20 68 | tempting.to.bind.two.identical.h |
0900 | 6f 73 74 2f 70 6f 72 74 73 2e 20 57 68 65 6e 0a 20 20 20 20 61 63 63 65 70 74 28 29 20 69 73 20 | ost/ports..When.....accept().is. |
0920 | 63 61 6c 6c 65 64 20 6f 6e 20 65 61 63 68 20 73 6f 63 6b 65 74 2c 20 74 68 65 20 73 65 63 6f 6e | called.on.each.socket,.the.secon |
0940 | 64 20 63 61 6c 6c 65 72 27 73 20 70 72 6f 63 65 73 73 20 77 69 6c 6c 20 73 74 65 61 6c 0a 20 20 | d.caller's.process.will.steal... |
0960 | 20 20 74 68 65 20 70 6f 72 74 20 66 72 6f 6d 20 74 68 65 20 66 69 72 73 74 20 63 61 6c 6c 65 72 | ..the.port.from.the.first.caller |
0980 | 2c 20 6c 65 61 76 69 6e 67 20 74 68 65 6d 20 62 6f 74 68 20 69 6e 20 61 6e 20 61 77 6b 77 61 72 | ,.leaving.them.both.in.an.awkwar |
09a0 | 64 6c 79 20 77 65 64 67 65 64 0a 20 20 20 20 73 74 61 74 65 20 77 68 65 72 65 20 74 68 65 79 27 | dly.wedged.....state.where.they' |
09c0 | 6c 6c 20 6e 6f 20 6c 6f 6e 67 65 72 20 72 65 73 70 6f 6e 64 20 74 6f 20 61 6e 79 20 73 69 67 6e | ll.no.longer.respond.to.any.sign |
09e0 | 61 6c 73 20 6f 72 20 67 72 61 63 65 66 75 6c 20 6b 69 6c 6c 73 2c 20 61 6e 64 0a 20 20 20 20 6d | als.or.graceful.kills,.and.....m |
0a00 | 75 73 74 20 62 65 20 66 6f 72 63 69 62 6c 79 20 6b 69 6c 6c 65 64 20 76 69 61 20 4f 70 65 6e 50 | ust.be.forcibly.killed.via.OpenP |
0a20 | 72 6f 63 65 73 73 28 29 2f 54 65 72 6d 69 6e 61 74 65 50 72 6f 63 65 73 73 28 29 2e 0a 0a 20 20 | rocess()/TerminateProcess()..... |
0a40 | 20 20 54 68 65 20 73 6f 6c 75 74 69 6f 6e 20 6f 6e 20 57 69 6e 64 6f 77 73 20 69 73 20 74 6f 20 | ..The.solution.on.Windows.is.to. |
0a60 | 75 73 65 20 74 68 65 20 53 4f 5f 45 58 43 4c 55 53 49 56 45 41 44 44 52 55 53 45 20 73 6f 63 6b | use.the.SO_EXCLUSIVEADDRUSE.sock |
0a80 | 65 74 20 6f 70 74 69 6f 6e 0a 20 20 20 20 69 6e 73 74 65 61 64 20 6f 66 20 53 4f 5f 52 45 55 53 | et.option.....instead.of.SO_REUS |
0aa0 | 45 41 44 44 52 2c 20 77 68 69 63 68 20 65 66 66 65 63 74 69 76 65 6c 79 20 61 66 66 6f 72 64 73 | EADDR,.which.effectively.affords |
0ac0 | 20 74 68 65 20 73 61 6d 65 20 73 65 6d 61 6e 74 69 63 73 20 61 73 0a 20 20 20 20 53 4f 5f 52 45 | .the.same.semantics.as.....SO_RE |
0ae0 | 55 53 45 41 44 44 52 20 6f 6e 20 55 6e 69 78 2e 20 20 47 69 76 65 6e 20 74 68 65 20 70 72 6f 70 | USEADDR.on.Unix...Given.the.prop |
0b00 | 65 6e 73 69 74 79 20 6f 66 20 55 6e 69 78 20 64 65 76 65 6c 6f 70 65 72 73 20 69 6e 20 74 68 65 | ensity.of.Unix.developers.in.the |
0b20 | 20 4f 70 65 6e 0a 20 20 20 20 53 6f 75 72 63 65 20 77 6f 72 6c 64 20 63 6f 6d 70 61 72 65 64 20 | .Open.....Source.world.compared. |
0b40 | 74 6f 20 57 69 6e 64 6f 77 73 20 6f 6e 65 73 2c 20 74 68 69 73 20 69 73 20 61 20 63 6f 6d 6d 6f | to.Windows.ones,.this.is.a.commo |
0b60 | 6e 20 6d 69 73 74 61 6b 65 2e 20 20 41 20 71 75 69 63 6b 0a 20 20 20 20 6c 6f 6f 6b 20 6f 76 65 | n.mistake...A.quick.....look.ove |
0b80 | 72 20 4f 70 65 6e 53 53 4c 27 73 20 30 2e 39 2e 38 67 20 73 6f 75 72 63 65 20 73 68 6f 77 73 20 | r.OpenSSL's.0.9.8g.source.shows. |
0ba0 | 74 68 61 74 20 74 68 65 79 20 75 73 65 20 53 4f 5f 52 45 55 53 45 41 44 44 52 20 77 68 65 6e 0a | that.they.use.SO_REUSEADDR.when. |
0bc0 | 20 20 20 20 6f 70 65 6e 73 73 6c 2e 65 78 65 20 69 73 20 63 61 6c 6c 65 64 20 77 69 74 68 20 74 | ....openssl.exe.is.called.with.t |
0be0 | 68 65 20 27 73 5f 73 65 72 76 65 72 27 20 6f 70 74 69 6f 6e 2c 20 66 6f 72 20 65 78 61 6d 70 6c | he.'s_server'.option,.for.exampl |
0c00 | 65 2e 20 53 65 65 0a 20 20 20 20 68 74 74 70 3a 2f 2f 62 75 67 73 2e 70 79 74 68 6f 6e 2e 6f 72 | e..See.....http://bugs.python.or |
0c20 | 67 2f 69 73 73 75 65 32 35 35 30 20 66 6f 72 20 6d 6f 72 65 20 69 6e 66 6f 2e 20 20 54 68 65 20 | g/issue2550.for.more.info...The. |
0c40 | 66 6f 6c 6c 6f 77 69 6e 67 20 73 69 74 65 20 61 6c 73 6f 0a 20 20 20 20 68 61 73 20 61 20 76 65 | following.site.also.....has.a.ve |
0c60 | 72 79 20 74 68 6f 72 6f 75 67 68 20 64 65 73 63 72 69 70 74 69 6f 6e 20 61 62 6f 75 74 20 74 68 | ry.thorough.description.about.th |
0c80 | 65 20 69 6d 70 6c 69 63 61 74 69 6f 6e 73 20 6f 66 20 62 6f 74 68 20 52 45 55 53 45 41 44 44 52 | e.implications.of.both.REUSEADDR |
0ca0 | 0a 20 20 20 20 61 6e 64 20 45 58 43 4c 55 53 49 56 45 41 44 44 52 55 53 45 20 6f 6e 20 57 69 6e | .....and.EXCLUSIVEADDRUSE.on.Win |
0cc0 | 64 6f 77 73 3a 0a 20 20 20 20 68 74 74 70 3a 2f 2f 6d 73 64 6e 32 2e 6d 69 63 72 6f 73 6f 66 74 | dows:.....http://msdn2.microsoft |
0ce0 | 2e 63 6f 6d 2f 65 6e 2d 75 73 2f 6c 69 62 72 61 72 79 2f 6d 73 37 34 30 36 32 31 28 56 53 2e 38 | .com/en-us/library/ms740621(VS.8 |
0d00 | 35 29 2e 61 73 70 78 29 0a 0a 20 20 20 20 58 58 58 3a 20 61 6c 74 68 6f 75 67 68 20 74 68 69 73 | 5).aspx)......XXX:.although.this |
0d20 | 20 61 70 70 72 6f 61 63 68 20 69 73 20 61 20 76 61 73 74 20 69 6d 70 72 6f 76 65 6d 65 6e 74 20 | .approach.is.a.vast.improvement. |
0d40 | 6f 6e 20 70 72 65 76 69 6f 75 73 20 61 74 74 65 6d 70 74 73 20 74 6f 0a 20 20 20 20 65 6c 69 63 | on.previous.attempts.to.....elic |
0d60 | 69 74 20 75 6e 75 73 65 64 20 70 6f 72 74 73 2c 20 69 74 20 72 65 73 74 73 20 68 65 61 76 69 6c | it.unused.ports,.it.rests.heavil |
0d80 | 79 20 6f 6e 20 74 68 65 20 61 73 73 75 6d 70 74 69 6f 6e 20 74 68 61 74 20 74 68 65 20 65 70 68 | y.on.the.assumption.that.the.eph |
0da0 | 65 6d 65 72 61 6c 0a 20 20 20 20 70 6f 72 74 20 72 65 74 75 72 6e 65 64 20 74 6f 20 75 73 20 62 | emeral.....port.returned.to.us.b |
0dc0 | 79 20 74 68 65 20 4f 53 20 77 6f 6e 27 74 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 62 65 20 64 69 | y.the.OS.won't.immediately.be.di |
0de0 | 73 68 65 64 20 62 61 63 6b 20 6f 75 74 20 74 6f 20 73 6f 6d 65 0a 20 20 20 20 6f 74 68 65 72 20 | shed.back.out.to.some.....other. |
0e00 | 70 72 6f 63 65 73 73 20 77 68 65 6e 20 77 65 20 63 6c 6f 73 65 20 61 6e 64 20 64 65 6c 65 74 65 | process.when.we.close.and.delete |
0e20 | 20 6f 75 72 20 74 65 6d 70 6f 72 61 72 79 20 73 6f 63 6b 65 74 20 62 75 74 20 62 65 66 6f 72 65 | .our.temporary.socket.but.before |
0e40 | 20 6f 75 72 0a 20 20 20 20 63 61 6c 6c 69 6e 67 20 63 6f 64 65 20 68 61 73 20 61 20 63 68 61 6e | .our.....calling.code.has.a.chan |
0e60 | 63 65 20 74 6f 20 62 69 6e 64 20 74 68 65 20 72 65 74 75 72 6e 65 64 20 70 6f 72 74 2e 20 20 57 | ce.to.bind.the.returned.port...W |
0e80 | 65 20 63 61 6e 20 64 65 61 6c 20 77 69 74 68 20 74 68 69 73 0a 20 20 20 20 69 73 73 75 65 20 69 | e.can.deal.with.this.....issue.i |
0ea0 | 66 2f 77 68 65 6e 20 77 65 20 63 6f 6d 65 20 61 63 72 6f 73 73 20 69 74 2e 28 03 00 00 00 74 06 | f/when.we.come.across.it.(....t. |
0ec0 | 00 00 00 73 6f 63 6b 65 74 74 09 00 00 00 62 69 6e 64 5f 70 6f 72 74 74 05 00 00 00 63 6c 6f 73 | ...sockett....bind_portt....clos |
0ee0 | 65 28 04 00 00 00 74 06 00 00 00 66 61 6d 69 6c 79 74 08 00 00 00 73 6f 63 6b 74 79 70 65 74 08 | e(....t....familyt....socktypet. |
0f00 | 00 00 00 74 65 6d 70 73 6f 63 6b 74 04 00 00 00 70 6f 72 74 28 00 00 00 00 28 00 00 00 00 73 33 | ...tempsockt....port(....(....s3 |
0f20 | 00 00 00 2f 55 73 65 72 73 2f 73 68 61 7a 6f 77 2f 70 72 6f 6a 65 63 74 73 2f 75 72 6c 6c 69 62 | .../Users/shazow/projects/urllib |
0f40 | 33 2f 74 65 73 74 2f 70 6f 72 74 5f 68 65 6c 70 65 72 73 2e 70 79 74 10 00 00 00 66 69 6e 64 5f | 3/test/port_helpers.pyt....find_ |
0f60 | 75 6e 75 73 65 64 5f 70 6f 72 74 0c 00 00 00 73 0a 00 00 00 00 36 12 01 0c 01 0a 01 03 01 63 02 | unused_port....s.....6........c. |
0f80 | 00 00 00 03 00 00 00 04 00 00 00 43 00 00 00 73 f7 00 00 00 7c 00 00 6a 00 00 74 01 00 6a 02 00 | ...........C...s....|..j..t..j.. |
0fa0 | 6b 02 00 72 d0 00 7c 00 00 6a 03 00 74 01 00 6a 04 00 6b 02 00 72 d0 00 74 05 00 74 01 00 64 01 | k..r..|..j..t..j..k..r..t..t..d. |
0fc0 | 00 83 02 00 72 63 00 7c 00 00 6a 06 00 74 01 00 6a 07 00 74 01 00 6a 08 00 83 02 00 64 02 00 6b | ....rc.|..j..t..j..t..j.....d..k |
0fe0 | 02 00 72 63 00 74 09 00 64 03 00 83 01 00 82 01 00 71 63 00 6e 00 00 74 05 00 74 01 00 64 04 00 | ..rc.t..d........qc.n..t..t..d.. |
1000 | 83 02 00 72 a2 00 7c 00 00 6a 06 00 74 01 00 6a 07 00 74 01 00 6a 0a 00 83 02 00 64 02 00 6b 02 | ...r..|..j..t..j..t..j.....d..k. |
1020 | 00 72 a2 00 74 09 00 64 05 00 83 01 00 82 01 00 71 a2 00 6e 00 00 74 05 00 74 01 00 64 06 00 83 | .r..t..d........q..n..t..t..d... |
1040 | 02 00 72 d0 00 7c 00 00 6a 0b 00 74 01 00 6a 07 00 74 01 00 6a 0c 00 64 02 00 83 03 00 01 71 d0 | ..r..|..j..t..j..t..j..d......q. |
1060 | 00 6e 00 00 7c 00 00 6a 0d 00 7c 01 00 64 07 00 66 02 00 83 01 00 01 7c 00 00 6a 0e 00 83 00 00 | .n..|..j..|..d..f......|..j..... |
1080 | 64 02 00 19 7d 02 00 7c 02 00 53 28 08 00 00 00 73 25 03 00 00 42 69 6e 64 20 74 68 65 20 73 6f | d...}..|..S(....s%...Bind.the.so |
10a0 | 63 6b 65 74 20 74 6f 20 61 20 66 72 65 65 20 70 6f 72 74 20 61 6e 64 20 72 65 74 75 72 6e 20 74 | cket.to.a.free.port.and.return.t |
10c0 | 68 65 20 70 6f 72 74 20 6e 75 6d 62 65 72 2e 20 20 52 65 6c 69 65 73 20 6f 6e 0a 20 20 20 20 65 | he.port.number...Relies.on.....e |
10e0 | 70 68 65 6d 65 72 61 6c 20 70 6f 72 74 73 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 65 6e 73 75 72 | phemeral.ports.in.order.to.ensur |
1100 | 65 20 77 65 20 61 72 65 20 75 73 69 6e 67 20 61 6e 20 75 6e 62 6f 75 6e 64 20 70 6f 72 74 2e 20 | e.we.are.using.an.unbound.port.. |
1120 | 20 54 68 69 73 20 69 73 0a 20 20 20 20 69 6d 70 6f 72 74 61 6e 74 20 61 73 20 6d 61 6e 79 20 74 | .This.is.....important.as.many.t |
1140 | 65 73 74 73 20 6d 61 79 20 62 65 20 72 75 6e 6e 69 6e 67 20 73 69 6d 75 6c 74 61 6e 65 6f 75 73 | ests.may.be.running.simultaneous |
1160 | 6c 79 2c 20 65 73 70 65 63 69 61 6c 6c 79 20 69 6e 20 61 0a 20 20 20 20 62 75 69 6c 64 62 6f 74 | ly,.especially.in.a.....buildbot |
1180 | 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 20 20 54 68 69 73 20 6d 65 74 68 6f 64 20 72 61 69 73 65 | .environment...This.method.raise |
11a0 | 73 20 61 6e 20 65 78 63 65 70 74 69 6f 6e 20 69 66 20 74 68 65 20 73 6f 63 6b 2e 66 61 6d 69 6c | s.an.exception.if.the.sock.famil |
11c0 | 79 0a 20 20 20 20 69 73 20 41 46 5f 49 4e 45 54 20 61 6e 64 20 73 6f 63 6b 2e 74 79 70 65 20 69 | y.....is.AF_INET.and.sock.type.i |
11e0 | 73 20 53 4f 43 4b 5f 53 54 52 45 41 4d 2c 20 2a 61 6e 64 2a 20 74 68 65 20 73 6f 63 6b 65 74 20 | s.SOCK_STREAM,.*and*.the.socket. |
1200 | 68 61 73 20 53 4f 5f 52 45 55 53 45 41 44 44 52 0a 20 20 20 20 6f 72 20 53 4f 5f 52 45 55 53 45 | has.SO_REUSEADDR.....or.SO_REUSE |
1220 | 50 4f 52 54 20 73 65 74 20 6f 6e 20 69 74 2e 20 20 54 65 73 74 73 20 73 68 6f 75 6c 64 20 2a 6e | PORT.set.on.it...Tests.should.*n |
1240 | 65 76 65 72 2a 20 73 65 74 20 74 68 65 73 65 20 73 6f 63 6b 65 74 20 6f 70 74 69 6f 6e 73 0a 20 | ever*.set.these.socket.options.. |
1260 | 20 20 20 66 6f 72 20 54 43 50 2f 49 50 20 73 6f 63 6b 65 74 73 2e 20 20 54 68 65 20 6f 6e 6c 79 | ...for.TCP/IP.sockets...The.only |
1280 | 20 63 61 73 65 20 66 6f 72 20 73 65 74 74 69 6e 67 20 74 68 65 73 65 20 6f 70 74 69 6f 6e 73 20 | .case.for.setting.these.options. |
12a0 | 69 73 20 74 65 73 74 69 6e 67 0a 20 20 20 20 6d 75 6c 74 69 63 61 73 74 69 6e 67 20 76 69 61 20 | is.testing.....multicasting.via. |
12c0 | 6d 75 6c 74 69 70 6c 65 20 55 44 50 20 73 6f 63 6b 65 74 73 2e 0a 0a 20 20 20 20 41 64 64 69 74 | multiple.UDP.sockets.......Addit |
12e0 | 69 6f 6e 61 6c 6c 79 2c 20 69 66 20 74 68 65 20 53 4f 5f 45 58 43 4c 55 53 49 56 45 41 44 44 52 | ionally,.if.the.SO_EXCLUSIVEADDR |
1300 | 55 53 45 20 73 6f 63 6b 65 74 20 6f 70 74 69 6f 6e 20 69 73 20 61 76 61 69 6c 61 62 6c 65 20 28 | USE.socket.option.is.available.( |
1320 | 69 2e 65 2e 0a 20 20 20 20 6f 6e 20 57 69 6e 64 6f 77 73 29 2c 20 69 74 20 77 69 6c 6c 20 62 65 | i.e......on.Windows),.it.will.be |
1340 | 20 73 65 74 20 6f 6e 20 74 68 65 20 73 6f 63 6b 65 74 2e 20 20 54 68 69 73 20 77 69 6c 6c 20 70 | .set.on.the.socket...This.will.p |
1360 | 72 65 76 65 6e 74 20 61 6e 79 6f 6e 65 20 65 6c 73 65 0a 20 20 20 20 66 72 6f 6d 20 62 69 6e 64 | revent.anyone.else.....from.bind |
1380 | 28 29 27 69 6e 67 20 74 6f 20 6f 75 72 20 68 6f 73 74 2f 70 6f 72 74 20 66 6f 72 20 74 68 65 20 | ()'ing.to.our.host/port.for.the. |
13a0 | 64 75 72 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 74 65 73 74 2e 0a 20 20 20 20 74 0c 00 00 00 53 | duration.of.the.test......t....S |
13c0 | 4f 5f 52 45 55 53 45 41 44 44 52 69 01 00 00 00 73 48 00 00 00 74 65 73 74 73 20 73 68 6f 75 6c | O_REUSEADDRi....sH...tests.shoul |
13e0 | 64 20 6e 65 76 65 72 20 73 65 74 20 74 68 65 20 53 4f 5f 52 45 55 53 45 41 44 44 52 20 73 6f 63 | d.never.set.the.SO_REUSEADDR.soc |
1400 | 6b 65 74 20 6f 70 74 69 6f 6e 20 6f 6e 20 54 43 50 2f 49 50 20 73 6f 63 6b 65 74 73 21 74 0c 00 | ket.option.on.TCP/IP.sockets!t.. |
1420 | 00 00 53 4f 5f 52 45 55 53 45 50 4f 52 54 73 48 00 00 00 74 65 73 74 73 20 73 68 6f 75 6c 64 20 | ..SO_REUSEPORTsH...tests.should. |
1440 | 6e 65 76 65 72 20 73 65 74 20 74 68 65 20 53 4f 5f 52 45 55 53 45 50 4f 52 54 20 73 6f 63 6b 65 | never.set.the.SO_REUSEPORT.socke |
1460 | 74 20 6f 70 74 69 6f 6e 20 6f 6e 20 54 43 50 2f 49 50 20 73 6f 63 6b 65 74 73 21 74 13 00 00 00 | t.option.on.TCP/IP.sockets!t.... |
1480 | 53 4f 5f 45 58 43 4c 55 53 49 56 45 41 44 44 52 55 53 45 69 00 00 00 00 28 0f 00 00 00 52 03 00 | SO_EXCLUSIVEADDRUSEi....(....R.. |
14a0 | 00 00 52 00 00 00 00 74 07 00 00 00 41 46 5f 49 4e 45 54 74 04 00 00 00 74 79 70 65 74 0b 00 00 | ..R....t....AF_INETt....typet... |
14c0 | 00 53 4f 43 4b 5f 53 54 52 45 41 4d 74 07 00 00 00 68 61 73 61 74 74 72 74 0a 00 00 00 67 65 74 | .SOCK_STREAMt....hasattrt....get |
14e0 | 73 6f 63 6b 6f 70 74 74 0a 00 00 00 53 4f 4c 5f 53 4f 43 4b 45 54 52 08 00 00 00 74 0a 00 00 00 | sockoptt....SOL_SOCKETR....t.... |
1500 | 56 61 6c 75 65 45 72 72 6f 72 52 09 00 00 00 74 0a 00 00 00 73 65 74 73 6f 63 6b 6f 70 74 52 0a | ValueErrorR....t....setsockoptR. |
1520 | 00 00 00 74 04 00 00 00 62 69 6e 64 74 0b 00 00 00 67 65 74 73 6f 63 6b 6e 61 6d 65 28 03 00 00 | ...t....bindt....getsockname(... |
1540 | 00 74 04 00 00 00 73 6f 63 6b 74 04 00 00 00 68 6f 73 74 52 06 00 00 00 28 00 00 00 00 28 00 00 | .t....sockt....hostR....(....(.. |
1560 | 00 00 73 33 00 00 00 2f 55 73 65 72 73 2f 73 68 61 7a 6f 77 2f 70 72 6f 6a 65 63 74 73 2f 75 72 | ..s3.../Users/shazow/projects/ur |
1580 | 6c 6c 69 62 33 2f 74 65 73 74 2f 70 6f 72 74 5f 68 65 6c 70 65 72 73 2e 70 79 52 01 00 00 00 48 | llib3/test/port_helpers.pyR....H |
15a0 | 00 00 00 73 18 00 00 00 00 0e 24 01 0f 01 1e 01 12 02 0f 01 1e 01 12 02 0f 01 1f 02 13 01 10 01 | ...s......$..................... |
15c0 | 28 07 00 00 00 52 00 00 00 00 74 04 00 00 00 48 4f 53 54 74 06 00 00 00 48 4f 53 54 76 36 52 0b | (....R....t....HOSTt....HOSTv6R. |
15e0 | 00 00 00 52 0d 00 00 00 52 07 00 00 00 52 01 00 00 00 28 00 00 00 00 28 00 00 00 00 28 00 00 00 | ...R....R....R....(....(....(... |
1600 | 00 73 33 00 00 00 2f 55 73 65 72 73 2f 73 68 61 7a 6f 77 2f 70 72 6f 6a 65 63 74 73 2f 75 72 6c | .s3.../Users/shazow/projects/url |
1620 | 6c 69 62 33 2f 74 65 73 74 2f 70 6f 72 74 5f 68 65 6c 70 65 72 73 2e 70 79 74 08 00 00 00 3c 6d | lib3/test/port_helpers.pyt....<m |
1640 | 6f 64 75 6c 65 3e 04 00 00 00 73 08 00 00 00 0c 05 06 01 06 02 15 3c | odule>....s...........< |