Skip to content

Commit beba316

Browse files
committed
Add print statements.
1 parent 381f841 commit beba316

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

utils/socket-utils/src/main/java17/datadog/common/socket/TunnelingJdkSocket.java

+23
Original file line numberDiff line numberDiff line change
@@ -123,37 +123,56 @@ public InputStream getInputStream() throws IOException {
123123
throw new SocketException("Socket input is shutdown");
124124
}
125125

126+
System.out.println("=====start=====");
127+
126128
Selector selector = Selector.open();
129+
System.out.println("=====1=====");
127130
unixSocketChannel.configureBlocking(false);
131+
System.out.println("=====2=====");
128132
unixSocketChannel.register(selector, SelectionKey.OP_READ);
133+
System.out.println("=====3=====");
129134
ByteBuffer buffer = ByteBuffer.allocate(256);
130135

136+
System.out.println("=====4=====");
137+
131138
try {
132139
while (true) {
133140
if (selector.select(timeout) == 0) {
134141
System.out.println("Timeout (" + timeout + "ms) while waiting for data.");
135142
break;
136143
}
144+
System.out.println("=====5=====");
137145
Iterator<SelectionKey> keyIterator = selector.selectedKeys().iterator();
146+
System.out.println("=====6=====");
138147
while (keyIterator.hasNext()) {
148+
System.out.println("=====7=====");
139149
SelectionKey key = keyIterator.next();
150+
System.out.println("=====8=====");
140151
keyIterator.remove();
152+
System.out.println("=====9=====");
141153
if (key.isReadable()) {
154+
System.out.println("=====10=====");
142155
int r = unixSocketChannel.read(buffer);
156+
System.out.println("=====11=====");
143157
if (r == -1) {
158+
System.out.println("=====12=====");
144159
unixSocketChannel.close();
145160
System.out.println("Not accepting client messages anymore.");
146161
return InputStream.nullInputStream();
147162
}
148163
}
149164
}
165+
System.out.println("=====13=====");
150166
buffer.flip();
151167
break;
152168
}
153169
} finally {
170+
System.out.println("=====14=====");
154171
selector.close();
155172
}
156173

174+
System.out.println("=====15=====");
175+
157176
return new InputStream() {
158177
@Override
159178
public int read() {
@@ -162,11 +181,15 @@ public int read() {
162181

163182
@Override
164183
public int read(byte[] bytes, int off, int len) {
184+
System.out.println("=====16=====");
165185
if (!buffer.hasRemaining()) {
186+
System.out.println("=====17=====");
166187
return -1;
167188
}
168189
len = Math.min(len, buffer.remaining());
190+
System.out.println("=====18=====");
169191
buffer.get(bytes, off, len);
192+
System.out.println("=====19=====");
170193
return len;
171194
}
172195
};

0 commit comments

Comments
 (0)