diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2005-04-21 03:15:34 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2005-04-21 03:15:34 +0000 |
| commit | 434e8e014cb21b8d15d512b966ea4f397fd0d369 (patch) | |
| tree | f8384d8064364331bf0549b2f518742d8f65ea9d /samples/forward.lua | |
| parent | 4e3cf63c95fc3c01a1c759e237678e9d3b2b8494 (diff) | |
| download | luasocket-434e8e014cb21b8d15d512b966ea4f397fd0d369.tar.gz luasocket-434e8e014cb21b8d15d512b966ea4f397fd0d369.tar.bz2 luasocket-434e8e014cb21b8d15d512b966ea4f397fd0d369.zip | |
Better connection handling.
Diffstat (limited to 'samples/forward.lua')
| -rw-r--r-- | samples/forward.lua | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/samples/forward.lua b/samples/forward.lua index ff65b84..e51c5ce 100644 --- a/samples/forward.lua +++ b/samples/forward.lua | |||
| @@ -76,13 +76,13 @@ function connect(who, host, port) | |||
| 76 | if not ret and err == "timeout" then | 76 | if not ret and err == "timeout" then |
| 77 | wait(who, "output") | 77 | wait(who, "output") |
| 78 | ret, err = who:connect(host, port) | 78 | ret, err = who:connect(host, port) |
| 79 | if not ret and err ~= "already connected" then | ||
| 80 | kick(who) | ||
| 81 | kick(context[who].peer) | ||
| 82 | return | ||
| 83 | end | ||
| 79 | end | 84 | end |
| 80 | if not ret then | 85 | return forward(who) |
| 81 | kick(who) | ||
| 82 | kick(context[who].peer) | ||
| 83 | else | ||
| 84 | return forward(who) | ||
| 85 | end | ||
| 86 | end | 86 | end |
| 87 | 87 | ||
| 88 | -- gets rid of a client | 88 | -- gets rid of a client |
