Skip to content

Commit

Permalink
Fix #103
Browse files Browse the repository at this point in the history
  • Loading branch information
nonlin-lin-chaos-order-etc-etal committed Nov 20, 2024
1 parent d7dfa22 commit 44e1c37
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/i2pd
Submodule i2pd updated 61 files
+0 −32 contrib/certificates/reseed/hiduser0_at_mail.i2p.crt
+20 −6 daemon/I2PControl.cpp
+3 −1 daemon/UnixDaemon.cpp
+1 −1 debian/changelog
+0 −1 libi2pd/Config.cpp
+1 −37 libi2pd/Crypto.cpp
+0 −6 libi2pd/Crypto.h
+54 −28 libi2pd/Destination.cpp
+19 −14 libi2pd/Destination.h
+2 −0 libi2pd/ECIESX25519AEADRatchetSession.cpp
+4 −2 libi2pd/ECIESX25519AEADRatchetSession.h
+1 −81 libi2pd/Ed25519.cpp
+2 −10 libi2pd/Ed25519.h
+26 −49 libi2pd/Family.cpp
+3 −3 libi2pd/Family.h
+20 −9 libi2pd/Garlic.cpp
+5 −2 libi2pd/Garlic.h
+1 −0 libi2pd/HTTP.cpp
+1 −378 libi2pd/I2NPProtocol.cpp
+2 −2 libi2pd/I2NPProtocol.h
+15 −0 libi2pd/LeaseSet.cpp
+3 −2 libi2pd/LeaseSet.h
+35 −13 libi2pd/NTCP2.cpp
+6 −3 libi2pd/NTCP2.h
+47 −45 libi2pd/NetDb.cpp
+1 −0 libi2pd/NetDb.hpp
+5 −3 libi2pd/Profiling.cpp
+13 −3 libi2pd/Profiling.h
+25 −15 libi2pd/Queue.h
+6 −4 libi2pd/RouterContext.cpp
+12 −12 libi2pd/RouterContext.h
+5 −3 libi2pd/RouterInfo.cpp
+4 −2 libi2pd/RouterInfo.h
+122 −75 libi2pd/SSU2.cpp
+17 −22 libi2pd/SSU2.h
+355 −0 libi2pd/SSU2OutOfSession.cpp
+86 −0 libi2pd/SSU2OutOfSession.h
+165 −348 libi2pd/SSU2Session.cpp
+18 −42 libi2pd/SSU2Session.h
+209 −121 libi2pd/Streaming.cpp
+9 −2 libi2pd/Streaming.h
+407 −3 libi2pd/TransitTunnel.cpp
+45 −3 libi2pd/TransitTunnel.h
+6 −2 libi2pd/TransportSession.h
+110 −55 libi2pd/Transports.cpp
+9 −5 libi2pd/Transports.h
+151 −70 libi2pd/Tunnel.cpp
+17 −9 libi2pd/Tunnel.h
+3 −1 libi2pd/TunnelConfig.h
+2 −2 libi2pd/TunnelGateway.cpp
+4 −4 libi2pd/TunnelPool.cpp
+9 −1 libi2pd/util.cpp
+5 −3 libi2pd/util.h
+35 −25 libi2pd_client/AddressBook.cpp
+5 −2 libi2pd_client/AddressBook.h
+19 −4 libi2pd_client/ClientContext.cpp
+3 −3 libi2pd_client/I2PTunnel.cpp
+1 −1 libi2pd_client/UDPTunnel.cpp
+0 −7 tests/CMakeLists.txt
+1 −4 tests/Makefile
+0 −38 tests/test-x25519.cpp
5 changes: 4 additions & 1 deletion src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ MainWindow::MainWindow(std::shared_ptr<std::iostream> logStream_, QWidget *paren
initStringBox( OPTION("addressbook","defaulturl",[]{return "";}), uiSettings->addressbookDefaultURLLineEdit);
initStringBox( OPTION("addressbook","subscriptions",[]{return "";}), uiSettings->addressbookSubscriptionsURLslineEdit);

initUInt16Box( OPTION("limits","transittunnels",[]{return "2500";}), uiSettings->maxNumOfTransitTunnelsLineEdit, tr("maxNumberOfTransitTunnels"));
initUIntBox( OPTION("limits","transittunnels",[]{return "2500";}), uiSettings->maxNumOfTransitTunnelsLineEdit, tr("maxNumberOfTransitTunnels"));
initUInt16Box( OPTION("limits","openfiles",[]{return "0";}), uiSettings->maxNumOfOpenFilesLineEdit, tr("maxNumberOfOpenFiles"));
initUInt32Box( OPTION("limits","coresize",[]{return "0";}), uiSettings->coreFileMaxSizeNumberLineEdit, tr("coreFileMaxSize"));

Expand Down Expand Up @@ -709,6 +709,9 @@ void MainWindow::initCheckBox(ConfigOption option, QCheckBox* checkBox) {
void MainWindow::initIntegerBox(ConfigOption option, QLineEdit* numberLineEdit, QString fieldNameTranslated){
configItems.append(new IntegerStringItem(option, numberLineEdit, fieldNameTranslated, this));
}
void MainWindow::initUIntBox(ConfigOption option, QLineEdit* numberLineEdit, QString fieldNameTranslated){
configItems.append(new UIntStringItem(option, numberLineEdit, fieldNameTranslated, this));
}
void MainWindow::initUInt32Box(ConfigOption option, QLineEdit* numberLineEdit, QString fieldNameTranslated){
configItems.append(new UInt32StringItem(option, numberLineEdit, fieldNameTranslated, this));
}
Expand Down
21 changes: 21 additions & 0 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ class MainWindowItem : public QObject {
out << boost::any_cast<uint32_t>(optionValue);
}else if(isType<int>(optionValue)) {
out << boost::any_cast<int>(optionValue);
}else if(isType<unsigned long>(optionValue)) {
out << boost::any_cast<unsigned long>(optionValue);
}else if(isType<unsigned short>(optionValue)) {
out << boost::any_cast<unsigned short>(optionValue);
}else out << boost::any_cast<std::string>(optionValue); //let it throw
Expand Down Expand Up @@ -330,6 +332,24 @@ class IntegerStringItem : public BaseFormattedStringItem {
virtual QString toString(){return QString::number(boost::any_cast<int>(optionValue));}
virtual boost::any fromString(QString s){return boost::any(std::stoi(s.toStdString()));}
};
class UIntStringItem : public BaseFormattedStringItem {
public:
UIntStringItem(ConfigOption option_, QLineEdit* lineEdit_, QString fieldNameTranslated_, MainWindow* mw) :
BaseFormattedStringItem(option_, lineEdit_, fieldNameTranslated_,
QApplication::tr("Must be a valid integer."), mw) {}
virtual ~UIntStringItem(){}
virtual bool isValid(bool & alreadyDisplayedIfWrong){
bool correct = BaseFormattedStringItem::isValid(alreadyDisplayedIfWrong);
if(!correct)return false;
alreadyDisplayedIfWrong = false;
auto str=lineEdit->text();
bool ok;
str.toUInt(&ok);
return ok;
}
virtual QString toString(){return QString::number(boost::any_cast<unsigned int>(optionValue));}
virtual boost::any fromString(QString s){return boost::any(std::stoul(s.toStdString()));}
};
class UShortStringItem : public BaseFormattedStringItem {
public:
UShortStringItem(ConfigOption option_, QLineEdit* lineEdit_, QString fieldNameTranslated_, MainWindow* mw) :
Expand Down Expand Up @@ -543,6 +563,7 @@ public slots:
void initTCPPortBox(ConfigOption option, QLineEdit* portLineEdit, QString fieldNameTranslated);
void initCheckBox(ConfigOption option, QCheckBox* checkBox);
void initIntegerBox(ConfigOption option, QLineEdit* numberLineEdit, QString fieldNameTranslated);
void initUIntBox(ConfigOption option, QLineEdit* numberLineEdit, QString fieldNameTranslated);
void initUInt32Box(ConfigOption option, QLineEdit* numberLineEdit, QString fieldNameTranslated);
void initUInt16Box(ConfigOption option, QLineEdit* numberLineEdit, QString fieldNameTranslated);
void initStringBox(ConfigOption option, QLineEdit* lineEdit);
Expand Down

0 comments on commit 44e1c37

Please sign in to comment.