File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
App-MHFS/lib/MHFS/Plugin/BitTorrent Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -160,14 +160,9 @@ sub announce {
160
160
if ($peer ne $ipport ) {
161
161
my @values = unpack (' CCCCCC' , $peer );
162
162
my $netmap = $request -> {' client' }{' server' }{' settings' }{' NETMAP' };
163
- my $pubip = $request -> {' client ' }{ ' server ' }{ ' settings ' }{ ' PUBLICIP ' };
163
+ my $pubip = $self -> {pubip };
164
164
if ($netmap && (($values [0] == $netmap -> [1]) && (unpack (' C' , $ipport ) != $netmap -> [1])) && $pubip ) {
165
- try {
166
- say " HACK converting local peer to public ip" ;
167
- $peer = pack (' Nn' , parse_ipv4($pubip ), (($values [4] << 8) | $values [5]));
168
- catch ($e ) {
169
- say " public ip didn't parse, cannot convert local peer to public ip"
170
- }
165
+ $peer = pack (' Nn' , $pubip , (($values [4] << 8) | $values [5]));
171
166
}
172
167
say __PACKAGE__ ." : sending peer " .peertostring($peer );
173
168
$pstr .= $peer ;
@@ -202,6 +197,11 @@ sub new {
202
197
bless $self , $class ;
203
198
say __PACKAGE__ ." : announce interval: " .$self -> {' announce_interval' };
204
199
200
+ if (exists $settings -> {' PUBLICIP' }) {
201
+ try { $self -> {pubip } = parse_ipv4($settings -> {' PUBLICIP' }); }
202
+ catch ($e ) {}
203
+ }
204
+
205
205
# load the existing torrents
206
206
my $odres = opendir (my $tdh , $settings -> {' MHFS_TRACKER_TORRENT_DIR' });
207
207
if (! $odres ){
You can’t perform that action at this time.
0 commit comments